[Nasm-bugs] [Bug 3392659] Crash in preproc.c:2452 when compiling libjpeg_turbo

noreply-nasm at dev.nasm.us noreply-nasm at dev.nasm.us
Mon Apr 20 15:13:47 PDT 2020


https://bugzilla.nasm.us/show_bug.cgi?id=3392659

Chang S. Bae <chang.seok.bae at intel.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|OPEN                        |CONFIRMED

--- Comment #1 from Chang S. Bae <chang.seok.bae at intel.com> ---
smacro_defined() may set NULL for the third argument even though it returns
true. So, an explicit check for it resolves the issue.

diff --git a/asm/preproc.c b/asm/preproc.c
index fae3b868..9ab05765 100644
--- a/asm/preproc.c
+++ b/asm/preproc.c
@@ -2448,7 +2448,7 @@ static enum cond_state if_condition(Token * tline, enum
preproc_token ct)

             mname = tok_text(tline);
             ctx = get_ctx(mname, &mname);
-            if (smacro_defined(ctx, mname, 0, &smac, true, alias)
+            if (smacro_defined(ctx, mname, 0, &smac, true, alias) && smac
                 && smac->alias == alias) {
                 j = true;
                 break;

The correspondent patch for this issue, for the record, is:

Author: H. Peter Anvin (Intel) <hpa at zytor.com>  2019-10-23 12:59:06
Committer: H. Peter Anvin (Intel) <hpa at zytor.com>  2019-10-23 12:59:06

    preproc: fix %undef of macro aliases, and add %ifdefalias

    Macro aliases can legitimately point to nonexistent
    macros. Furthermore, %undef should remove the pointed-at macro, not
    the alias. This led to an infinite loop in the existing code; fix
    that.

    Add an %ifdefalias directive to test for the existence of an alias.

    Signed-off-by: H. Peter Anvin (Intel) <hpa at zytor.com>

-- 
You are receiving this mail because:
You are watching all bug changes.
You are on the CC list for the bug.


More information about the Nasm-bugs mailing list