shithub: rgbds

Download patch

ref: e25a4b0abc29eb82842b4d79b4586989c172045e
parent: 16fac50db455b5a94ef4b6342345ae677ea7f7cd
parent: f5d3087e9bd13970453d3bf5802fd7ac396d2dba
author: Antonio Niño Díaz <antonio_nd@outlook.com>
date: Tue Dec 4 16:07:08 EST 2018

Merge pull request #309 from dbrotz/master

Fix #308

--- a/src/asm/globlex.c
+++ b/src/asm/globlex.c
@@ -100,7 +100,13 @@
 		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') {
--- 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