diff --git a/src/asm/globlex.c b/src/asm/globlex.c index b9d7e96d..12bb1e4e 100644 --- a/src/asm/globlex.c +++ b/src/asm/globlex.c @@ -100,7 +100,13 @@ static int32_t ascii2bin(char *s) break; } - if (radix == 4) { + if (*s == '\0') { + /* + * There are no digits after the radix prefix + * (or the string is empty, which shouldn't happen). + */ + yyerror("Invalid integer constant"); + } else if (radix == 4) { int32_t c; while (*s != '\0') { diff --git a/test/asm/divzero-section-bank.out b/test/asm/divzero-section-bank.out index b382e48f..553b2800 100644 --- a/test/asm/divzero-section-bank.out +++ b/test/asm/divzero-section-bank.out @@ -1,2 +1,4 @@ +ERROR: divzero-section-bank.asm(1): + Invalid integer constant ERROR: divzero-section-bank.asm(1): Division by zero