From e996d28c70d45008085322b442b44a9224308548 Mon Sep 17 00:00:00 2001 From: Cyrill Gorcunov Date: Sat, 13 Oct 2018 16:18:16 +0300 Subject: [PATCH] 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 --- asm/nasm.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/asm/nasm.c b/asm/nasm.c index 0deec783..ae90b89c 100644 --- a/asm/nasm.c +++ b/asm/nasm.c @@ -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);