asm/preproc.c: fix NULL pointer on %exitrep outside %rep When %exitrep incorrectly occurs outside a %rep block, do_exit_macro() returns NULL, but the %exitrep code would try to set m->in_progress = 1 anyway, causing a NULL pointer dereference and crashing NASM. Add a NULL pointer guard around this assignment; an error has already been issued. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
diff --git a/asm/preproc.c b/asm/preproc.c index 8e876a1..75e4aac 100644 --- a/asm/preproc.c +++ b/asm/preproc.c
@@ -5204,7 +5204,8 @@ case PP_EXITREP: { MMacro *m = do_exit_macro(dname, false); - m->in_progress = 1; /* No more repeats */ + if (m) + m->in_progress = 1; /* No more repeats */ break; }