shithub: scc

Download patch

ref: 5510ac1ca190a4bacb6330ca37a7ab5f0b347225
parent: 98caf6b9f86aa7e0af46d9de891e467364be6d2d
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Fri Aug 21 09:01:52 EDT 2015

Don't search in the argument array when there is no arguments

This error was causing an invalid access to args array, because
nargs could be -1, and the fallback condition to print again
the token was failling due to it.

--- a/cc1/cpp.c
+++ b/cc1/cpp.c
@@ -285,7 +285,7 @@
 
 	for (;;) {
 		ispar = 0;
-		if (yytoken == IDEN) {
+		if (yytoken == IDEN && nargs >= 0) {
 			for (argp = args; argp < &args[nargs]; ++argp) {
 				if (*argp == yylval.sym)
 					break;