[nasm:master] preproc: fix memory leak (and possibly CVEs?)

nasm-bot for zhrf2020 69804712+zhrf2020 at users.noreply.github.com
Mon Nov 7 17:12:39 PST 2022


Commit-ID:  8fcc785f95b842694015e03d909a3131cbadbeb3
Gitweb:     http://repo.or.cz/w/nasm.git?a=commitdiff;h=8fcc785f95b842694015e03d909a3131cbadbeb3
Author:     zhrf2020 <69804712+zhrf2020 at users.noreply.github.com>
AuthorDate: Thu, 11 Aug 2022 22:31:07 +0800
Committer:  H. Peter Anvin <hpa at zytor.com>
CommitDate: Mon, 7 Nov 2022 12:34:04 -0800

preproc: fix memory leak (and possibly CVEs?)

    case PP_ENDM:
    case PP_ENDMACRO:
        if (!(defining && defining->name)) {
            nasm_nonfatal("`%s': not defining a macro", tok_text(tline));
            goto done;
        }
        mmhead = (MMacro **) hash_findi_add(&mmacros, defining->name);
        defining->next = *mmhead;
        *mmhead = defining;
        defining = NULL;
        break;

The variable: mmacros has not been released, which will cause a memory
leak. Repair cve-2021-33450 cve-2021-33452 synchronously

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


---
 asm/preproc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/asm/preproc.c b/asm/preproc.c
index a12c96a2..92a790e5 100644
--- a/asm/preproc.c
+++ b/asm/preproc.c
@@ -4861,6 +4861,7 @@ issue_error:
     }
 
 done:
+    free_mmacro_table(&mmacros);
     free_tlist(origline);
     return DIRECTIVE_FOUND;
 }


More information about the Nasm-commits mailing list