summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2019-08-27 17:19:07 -0700
committerH. Peter Anvin <hpa@zytor.com>2019-08-27 17:19:07 -0700
commit2201ceb23803f7af9469bfe67985a7125b5ba9ed (patch)
treedd5cc7e7c6bd07ba23dc3a456772248a8769b354
parentd235408c65fc8176fdd94dd9f7d49074828bfa86 (diff)
downloadnasm-2201ceb23803f7af9469bfe67985a7125b5ba9ed.tar.gz
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 <hpa@zytor.com>
-rw-r--r--asm/nasm.c3
1 files changed, 2 insertions, 1 deletions
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: