spasm-ng
spasm-ng copied to clipboard
Unclosed parens followed by EOF cause a crash
A file containing only the string b( (no newline) causes the assembler to crash. Stack trace looks like this:
Pass one...
Program received signal SIGSEGV, Segmentation fault.
__strlen_avx2 () at ../sysdeps/x86_64/multiarch/strlen-avx2.S:76
76 VPCMPEQ (%rdi), %ymm0, %ymm1
(gdb) where
#0 __strlen_avx2 () at ../sysdeps/x86_64/multiarch/strlen-avx2.S:76
#1 0x00007ffff70606e9 in __printf_buffer (buf=buf@entry=0x7fffffffcbe0, format=0x555555578e88 "The opcode %s was given invalid operands",
ap=0x7fffffffce80, mode_flags=mode_flags@entry=0) at /usr/src/debug/glibc/glibc/stdio-common/vfprintf-process-arg.c:435
#2 0x00007ffff7081535 in __vsnprintf_internal (mode_flags=0, args=<optimized out>, format=<optimized out>, maxlen=<optimized out>, string=<optimized out>)
at vsnprintf.c:96
#3 ___vsnprintf (string=<optimized out>, maxlen=<optimized out>, format=<optimized out>, args=<optimized out>) at vsnprintf.c:103
#4 0x0000555555574a9a in SetLastSPASMProblem(DWORD, bool, typedef __va_list_tag __va_list_tag *) (dwErrorCode=272, fIsWarning=false, valist=0x7fffffffce80)
at errors.cpp:351
#5 0x0000555555574d8f in SetLastSPASMError (dwErrorCode=272) at errors.cpp:395
#6 0x00005555555655bd in handle_opcode_or_macro (ptr=0x5555555aa082 "\n") at pass_one.cpp:344
#7 0x0000555555564f88 in run_first_pass_line_sec (ptr=0x5555555aa080 "b(\n") at pass_one.cpp:204
#8 0x0000555555564eaa in run_first_pass_line (ptr=0x5555555aa080 "b(\n") at pass_one.cpp:173
#9 0x0000555555564def in run_first_pass (ptr=0x5555555aa080 "b(\n") at pass_one.cpp:141
#10 0x000055555556395c in run_assembly () at main.cpp:119
#11 0x000055555556461f in main (argc=2, argv=0x7fffffffe5c8) at main.cpp:449
It looks like this is some kind of varargs misuse, since it seems to bomb out when formatting The opcode %s was given invalid operands and it looks like the parameter is null.