shithub: rgbds

Download patch

ref: 889dd83798f108d1d26bba84b6412b36a03e87b8
parent: 2e6f5ac679b6fec430023a1527fb4d4f9a8bfc82
author: dbrotz <[email protected]>
date: Mon Sep 9 05:46:18 EDT 2019

Print useful error message when '\0' is used in a symbol name
AppendMacroArg() was passing 0 to sym_FindMacroArg(), which caused an assertion
failure. Now, AppendMacroArg() prints an error message instead.

--- a/src/asm/globlex.c
+++ b/src/asm/globlex.c
@@ -198,10 +198,10 @@
 
 	if (whichArg == '@')
 		marg = sym_FindMacroArg(-1);
-	else if (whichArg >= '0' && whichArg <= '9')
+	else if (whichArg >= '1' && whichArg <= '9')
 		marg = sym_FindMacroArg(whichArg - '0');
 	else
-		fatalerror("Malformed ID");
+		fatalerror("Invalid macro argument '\\%c' in symbol", whichArg);
 
 	if (!marg)
 		fatalerror("Macro argument '\\%c' not defined", whichArg);
--- /dev/null
+++ b/test/asm/symbol-invalid-macro-arg.asm
@@ -1,0 +1,1 @@
+x\0
--- /dev/null
+++ b/test/asm/symbol-invalid-macro-arg.out
@@ -1,0 +1,2 @@
+ERROR: symbol-invalid-macro-arg.asm(1):
+    Invalid macro argument '\0' in symbol