summaryrefslogtreecommitdiff
path: root/util/romcc
diff options
context:
space:
mode:
authorPatrick Georgi <pgeorgi@chromium.org>2017-01-02 19:15:44 +0100
committerPatrick Georgi <pgeorgi@google.com>2017-01-03 22:16:50 +0100
commitd8051896fd92c1250499a21c9cda0b4c834b8c68 (patch)
treea1c99e1caa3b556be9dc24d94ad598549c94d902 /util/romcc
parent61dbbf65c3423ba7903fca960e9da892b96a534c (diff)
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>
Diffstat (limited to 'util/romcc')
-rw-r--r--util/romcc/romcc.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/util/romcc/romcc.c b/util/romcc/romcc.c
index 2fa400af2b..62fe758ef6 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;