diff options
author | Cyrill Gorcunov <gorcunov@gmail.com> | 2018-10-13 16:18:16 +0300 |
---|---|---|
committer | Cyrill Gorcunov <gorcunov@gmail.com> | 2018-10-13 16:18:16 +0300 |
commit | e996d28c70d45008085322b442b44a9224308548 (patch) | |
tree | b2f289831395162a5ac8f332535b633320ec668f | |
parent | 703e5658498222c3aa77e57fefb466d264abbe58 (diff) | |
download | nasm-e996d28c70d45008085322b442b44a9224308548.tar.gz |
labels: Don't nil dereference if no label provided
An equ without label may cause nil dereference
| equ 0x100
Fixes 98578071b9d71ecaa2344dd9c185237c1765041e
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
-rw-r--r-- | asm/nasm.c | 12 |
1 files changed, 5 insertions, 7 deletions
@@ -1481,13 +1481,11 @@ static void assemble_file(const char *fname, StrList **depend_ptr) /* forw_ref */ if (output_ins.opcode == I_EQU) { - if (!output_ins.label) - nasm_error(ERR_NONFATAL, - "EQU not preceded by label"); - - if (output_ins.operands == 1 && - (output_ins.oprs[0].type & IMMEDIATE) && - output_ins.oprs[0].wrt == NO_SEG) { + if (!output_ins.label) { + nasm_error(ERR_NONFATAL, "EQU not preceded by label"); + } else if (output_ins.operands == 1 && + (output_ins.oprs[0].type & IMMEDIATE) && + output_ins.oprs[0].wrt == NO_SEG) { define_label(output_ins.label, output_ins.oprs[0].segment, output_ins.oprs[0].offset, false); |