From 2201ceb23803f7af9469bfe67985a7125b5ba9ed Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Tue, 27 Aug 2019 17:19:07 -0700 Subject: nasm: avoid null pointer reference on VERY early memory allocation failure If we get a memory allocation failure before preproc is initialized, we could end up taking a NULL pointer reference while trying to unwind macros. Signed-off-by: H. Peter Anvin --- asm/nasm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/asm/nasm.c b/asm/nasm.c index fd700df2..ac005edb 100644 --- a/asm/nasm.c +++ b/asm/nasm.c @@ -1927,7 +1927,8 @@ static void nasm_verror_asm(errflags severity, const char *fmt, va_list args) /* error_list_macros can for obvious reasons not work with ERR_HERE */ if (!(severity & ERR_HERE)) - preproc->error_list_macros(severity); + if (preproc) + preproc->error_list_macros(severity); switch (true_type) { case ERR_LISTMSG: -- cgit