dasm-assembler / dasm-assembler/dasm
SEGV in error handling of command line parameters
Open
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 257
- Forks
- 55
- PR merge metrics
- No merged PRs in 30d
Description
Trying to define a macro on the command line as follows:
dasm firmware.asm -ofirmware.bin -DFW_VERSION=1.aa -f3 -S -sfirmware.sym
results in:
Program received signal SIGSEGV, Segmentation fault.
asmerr (err=6, bAbort=false, sText=0x7fffffffddf4 "1.aa") at main.c:1578
1578 main.c: No such file or directory.
(gdb) where
#0 asmerr (err=6, bAbort=false, sText=0x7fffffffddf4 "1.aa") at main.c:1578
#1 0x0000000000409fac in eval (str=0x7fffffffddf8 "", wantmode=0) at exp.c:575
#2 0x0000000000407dca in v_set (str=0x7fffffffddf4 "1.aa", dummy=0x0) at ops.c:1232
#3 0x0000000000401fa8 in MainShadow (ac=7, av=0x7fffffffd948, pbTableSort=0x7fffffffd84b) at main.c:490
#4 0x0000000000404cde in main (ac=7, av=0x7fffffffd948) at main.c:1747
This seems to be as a result of bStopAtEnd being NULL
(gdb) print err
$1 = 6
(gdb) print bStopAtEnd
$2 = (_Bool *) 0x0
it is malloc()after command line arguments are processed.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the command in the report, then inspect MainShadow in main.c and the asmerr/eval/v_set path shown in the backtrace across main.c, exp.c, and ops.c. Check the bStopAtEnd allocation timing and confirm that the invalid macro value no longer causes SIGSEGV; done means the command reports an error instead of crashing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- cli, compilers
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100