shithub: scc

Download patch

ref: ffe00cd02c8c8d38ddb845c3dc54d20dfce61985
parent: b897cc9196148250fe2aeb826dd022f65dec6e2d
author: Roberto E. Vargas Caballero <[email protected]>
date: Tue Feb 14 17:39:11 EST 2017

[cc1] Fix segfault in mktype()

The patch 6ab66ac added a check about the last parameter
in the parameter list, but this check was incorrect when nelem == 0,
because we were accesing further or the borders of the array.

--- a/cc1/types.c
+++ b/cc1/types.c
@@ -301,7 +301,7 @@
 		type.letter = L_FUNCTION;
 		break;
 	case FTN:
-		if (pars[nelem-1] == ellipsistype)
+		if (nelem > 0 && pars[nelem-1] == ellipsistype)
 			type.prop |= TELLIPSIS;
 		type.letter = L_FUNCTION;
 		break;