mirror of
https://github.com/netwide-assembler/nasm.git
synced 2025-02-17 17:19:35 +08:00
BR 3392437: Fix diagnostic for negative value in TIMES
Issue a diagnostic and don't panic for invalid TIMES values. Reported-by: C. Masloch <pushbx@38.de> Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
This commit is contained in:
parent
230db148a3
commit
94ead27971
@ -603,6 +603,9 @@ int64_t assemble(int32_t segment, int64_t start, int bits, insn *instruction)
|
||||
size_t blk = 0; /* Buffered I/O block size */
|
||||
size_t m = 0; /* Bytes last read */
|
||||
|
||||
if (!t)
|
||||
goto done;
|
||||
|
||||
fp = nasm_open_read(fname, NF_BINARY|NF_FORMAP);
|
||||
if (!fp) {
|
||||
nasm_error(ERR_NONFATAL, "`incbin': unable to open file `%s'",
|
||||
|
@ -515,9 +515,8 @@ restart_parse:
|
||||
result->times = 1L;
|
||||
} else {
|
||||
result->times = value->value;
|
||||
if (value->value < 0 && pass0 == 2) {
|
||||
nasm_error(ERR_NONFATAL, "TIMES value %"PRId64" is negative",
|
||||
value->value);
|
||||
if (value->value < 0) {
|
||||
nasm_error(ERR_NONFATAL|ERR_PASS2, "TIMES value %"PRId64" is negative", value->value);
|
||||
result->times = 0;
|
||||
}
|
||||
}
|
||||
|
3
test/timesneg.asm
Normal file
3
test/timesneg.asm
Normal file
@ -0,0 +1,3 @@
|
||||
bits 32
|
||||
times -1 db 0
|
||||
times -1 incbin "timesneg.asm"
|
Loading…
Reference in New Issue
Block a user