[hackers] [scc] [cc1] Fix segfault in mktype() || Roberto E. Vargas Caballero
commit 4f5352fb2ecb3babe3122478bf0576f8905f1afc
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Tue Feb 14 22:39:11 2017 +0100
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Tue Feb 14 22:39:11 2017 +0100
[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.
diff --git a/cc1/types.c b/cc1/types.c
index 7d446ef..a367d0b 100644
--- a/cc1/types.c
+++ b/cc1/types.c
_AT_@ -301,7 +301,7 @@ mktype(Type *tp, int op, TINT nelem, Type *pars[])
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;
Received on Tue Feb 14 2017 - 22:41:14 CET
This archive was generated by hypermail 2.3.0
: Tue Feb 14 2017 - 22:48:17 CET