diff options
author | H. Peter Anvin <hpa@zytor.com> | 2019-08-27 17:19:07 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2019-08-27 17:19:07 -0700 |
commit | 2201ceb23803f7af9469bfe67985a7125b5ba9ed (patch) | |
tree | dd5cc7e7c6bd07ba23dc3a456772248a8769b354 | |
parent | d235408c65fc8176fdd94dd9f7d49074828bfa86 (diff) | |
download | nasm-2201ceb23803f7af9469bfe67985a7125b5ba9ed.tar.gz nasm-2201ceb23803f7af9469bfe67985a7125b5ba9ed.tar.xz nasm-2201ceb23803f7af9469bfe67985a7125b5ba9ed.zip |
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.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -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: |