new file mode 100644
@@ -0,0 +1,43 @@
+From b5235c49f09eeed65cdf0dfccf7f261d629c4878 Mon Sep 17 00:00:00 2001
+From: Yongjie2017 <sheng.yongjie@outlook.com>
+Date: Fri, 17 Apr 2026 06:35:57 +0800
+Subject: [PATCH] asm/preproc.c: fix
+ https://nvd.nist.gov/vuln/detail/CVE-2025-8842 When there is an ill formed
+ assembly (e.g. a macro without a correct ending), the assembly processing
+ will end with a defining->refcnt in non-zero value that further causes a
+ nasm_assert in free_mmacro, the nasm_assert causes a panic.
+
+Force the defining->refcnt to zero in pp_clean_pass as a bailout.
+
+Signed-off-by: Yongjie Sheng (Intel) <sheng.yongjie@outlook.com>
+
+CVE: CVE-2025-8842
+
+Upstream-Status: Backport [https://github.com/netwide-assembler/nasm/commit/b5235c49f0]
+
+Signed-off-by: Guocai He <guocai.he.cn@windriver.com>
+Signed-off-by: Josiah Metz <Josiah.Metz@windriver.com>
+---
+ asm/preproc.c | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git a/asm/preproc.c b/asm/preproc.c
+index e169d1a5..776a5223 100644
+--- a/asm/preproc.c
++++ b/asm/preproc.c
+@@ -8837,6 +8837,15 @@ void pp_cleanup_pass(void)
+ nasm_nonfatal("end of file while still in %%rep");
+ }
+
++ if (defining->refcnt != 0)
++ {
++ /* This can happen if a macro is ill formed without a correct ending
++ * and the macro is still referenced.
++ * In this case, we just set the refcnt to 0 to avoid a memory leak.
++ */
++ defining->refcnt = 0;
++ }
++
+ free_mmacro(defining);
+ defining = NULL;
+ }
@@ -13,6 +13,7 @@ SRC_URI = "http://www.nasm.us/pub/nasm/releasebuilds/${PV}/nasm-${PV}.tar.bz2 \
file://CVE-2026-6068-1.patch \
file://CVE-2026-6068-2.patch \
file://CVE-2026-6068-3.patch \
+ file://CVE-2025-8842.patch \
"
SRC_URI[sha256sum] = "7a7b1ff3b0eef3247862f2fbe4ca605ccef770545d7af7979eba84a9d045c0b1"
This patch applies the fix commit in [3] for CVE-2025-8842 in NASM. This fixes a NASM panic in free_mmacro. The fix commit is referenced in [2] and the public advisory is referenced in [1]. [1] https://nvd.nist.gov/vuln/detail/CVE-2025-8842 [2] https://security-tracker.debian.org/tracker/CVE-2025-8842 [3] https://github.com/netwide-assembler/nasm/commit/b5235c49f09eeed65cdf0dfccf7f261d629c4878 Notes: This fix applies to NASM 3.01 on wrynose, but the fix is present on NASM 3.02 so this fix is not needed on master or blacksail. Signed-off-by: Josiah Metz <Josiah.Metz@windriver.com> --- .../nasm/nasm/CVE-2025-8842.patch | 43 +++++++++++++++++++ meta/recipes-devtools/nasm/nasm_3.01.bb | 1 + 2 files changed, 44 insertions(+) create mode 100644 meta/recipes-devtools/nasm/nasm/CVE-2025-8842.patch