From dbc18f4cb01c3fbd169bca961e2c4d797f4974b8 Mon Sep 17 00:00:00 2001 From: Lukas Krickl Date: Wed, 3 Jan 2024 21:41:47 +0100 Subject: [PATCH] Fixed segfault. TODO: macros do not expand strings properly --- src/ulas.c | 4 ++++ tests/t0.s | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/ulas.c b/src/ulas.c index 73e8c28..e856721 100644 --- a/src/ulas.c +++ b/src/ulas.c @@ -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 diff --git a/tests/t0.s b/tests/t0.s index 0609ee7..718063a 100644 --- a/tests/t0.s +++ b/tests/t0.s @@ -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" -- 2.30.2