util/romcc: avoid dereferencing NULL pointer

argv is only filled for macro->argc > 0.

Change-Id: I5ff21098384afc823efa14be3d5565507fb2b3b2
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Found-by: Coverity Scan #1287089
Reviewed-on: https://review.coreboot.org/18016
Tested-by: build bot (Jenkins)
Reviewed-by: Martin Roth <martinroth@google.com>
This commit is contained in:
Patrick Georgi 2017-01-02 19:15:44 +01:00 committed by Patrick Georgi
parent 61dbbf65c3
commit d8051896fd
1 changed files with 3 additions and 0 deletions

View File

@ -4580,6 +4580,9 @@ static void expand_macro(struct compile_state *state,
flen = fmacro.pos - fstart;
switch(tk->tok) {
case TOK_IDENT:
if (macro->argc < 0) {
break;
}
for(i = 0; i < macro->argc; i++) {
if (argv[i].ident == tk->ident) {
break;