commit 9e4dc8bf34a6c59f7073d95dc7df06d91168d833
Author: Roberto E. Vargas Caballero <[email protected]>
AuthorDate: Sun Jul 19 09:31:38 2015 +0200
Commit: Roberto E. Vargas Caballero <[email protected]>
CommitDate: Sun Jul 19 09:31:38 2015 +0200
Avoid segfault in expand()
The debug fprintf in expect() was using macroname, which was
not defined in the case of symfile and symline.
diff --git a/cc1/cpp.c b/cc1/cpp.c
index c86002f..f236723 100644
--- a/cc1/cpp.c
+++ b/cc1/cpp.c
@@ -194,6 +194,7 @@ expand(char *begin, Symbol *sym)
char *s = sym->u.s;
char *arglist[NR_MACROARG], arguments[INPUTSIZ], buffer[BUFSIZE];
+ macroname = sym->name;
if (sym == symfile) {
elen = sprintf(buffer, "\"%s\"", input->fname);
goto substitute;
@@ -203,7 +204,6 @@ expand(char *begin, Symbol *sym)
goto substitute;
}
- macroname = sym->name;
if (!parsepars(arguments, arglist, atoi(s)))
return 0;
for (n = 0; n < atoi(s); ++n)