Patrick Georgi (pgeorgi@google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/18016
-gerrit
commit 997e1da9466b98d917d4afadb7621c27a8935329 Author: Patrick Georgi pgeorgi@chromium.org Date: Mon Jan 2 19:15:44 2017 +0100
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 --- util/romcc/romcc.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/util/romcc/romcc.c b/util/romcc/romcc.c index 7217c8c..3574ca0 100644 --- a/util/romcc/romcc.c +++ b/util/romcc/romcc.c @@ -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;