[nasm:nasm-2.16.xx] BR 3392906: error out on bad syntax "db 1 2"

nasm-bot for H. Peter Anvin hpa at zytor.com
Wed Oct 11 12:04:04 PDT 2023


Commit-ID:  e3bbd27b49305360b240009a9d5d379a38fcb4e0
Gitweb:     http://repo.or.cz/w/nasm.git?a=commitdiff;h=e3bbd27b49305360b240009a9d5d379a38fcb4e0
Author:     H. Peter Anvin <hpa at zytor.com>
AuthorDate: Wed, 11 Oct 2023 12:01:22 -0700
Committer:  H. Peter Anvin <hpa at zytor.com>
CommitDate: Wed, 11 Oct 2023 12:03:29 -0700

BR 3392906: error out on bad syntax "db 1 2"

NASM would try to "eat the comma token" in db expressions, even for
cases where the token was not a comma. Fix that and error out
properly.

To give better error messages, track where in the input string a token
starts or ends. This information is only valid as long as the input
string is kept, but that is just fine for error messages during
parsing.

Reported-by: Peter Cordes <pcordes at gmail.com>
Signed-off-by: H. Peter Anvin <hpa at zytor.com>


---
 test/baddb.asm | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/test/baddb.asm b/test/baddb.asm
new file mode 100644
index 00000000..1ff4fab4
--- /dev/null
+++ b/test/baddb.asm
@@ -0,0 +1,5 @@
+	;; This should error
+	db 1 2
+
+	;; This should work
+	db 1, 2


More information about the Nasm-commits mailing list