Fixed segfault. TODO: macros do not expand strings properly
authorLukas Krickl <lukas@krickl.dev>
Wed, 3 Jan 2024 20:41:47 +0000 (21:41 +0100)
committerLukas Krickl <lukas@krickl.dev>
Wed, 3 Jan 2024 20:41:47 +0000 (21:41 +0100)
src/ulas.c
tests/t0.s

index 73e8c28025b00fb8d9f4be46c42ef9f75d246bee..e85672115ae3fa0b9006a0bd518d306c40323a4e 100644 (file)
@@ -2473,6 +2473,10 @@ int ulas_asmdirstr(FILE *dst, const char **line, unsigned long n, int *rc) {
 
   do {
     char *s = ulas_strexpr(line, n, rc);
+    if (!s || *rc != 0) {
+      *rc = -1;
+      return 0;
+    }
     long len = strlen(s);
 
     // apply char code map
index 0609ee72fdb974b17493bd879f919e589ca127a8..718063aca0c5a4fb60e5a761972c3b9d1f26f06e 100644 (file)
@@ -138,6 +138,7 @@ l3: .db 1
 .db $10
 .db $11
 .db $12
+.str $13
 #endmacro
 
-testmacro 1, 2, 3, 4, 5, 6, 7, 8, 9, 61, 62, 63 
+testmacro 1, 2, 3, 4, 5, 6, 7, 8, 9, 61, 62, 63, "test"