yasm: patch CVE-2021-33456

Details: https://nvd.nist.gov/vuln/detail/CVE-2021-33465

The patch was taken from Debian:
https://sources.debian.org/patches/yasm/1.3.0-8/1020-hash-null-CVE-2021-33456.patch/

Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
Gyorgy Sarvari 2025-11-15 19:18:10 +01:00 committed by Khem Raj
parent 66a0b01b52
commit 1e2731fce0
No known key found for this signature in database
GPG Key ID: BB053355919D3314
2 changed files with 36 additions and 0 deletions

View File

@ -0,0 +1,35 @@
From 1126140b8f5ece18c58640725f0e4c08e5ec97b0 Mon Sep 17 00:00:00 2001
From: Gyorgy Sarvari <skandigraun@gmail.com>
Date: Sat, 15 Nov 2025 13:34:15 +0100
Subject: [PATCH] A potential null pointer difference is that the return value
of the hash may be null. This fixes CVE-2021-33456.
From: lixuebing <lixuebing@cqsoftware.com.cn>
Date: Mon, 25 Aug 2025 13:51:28 +0800
Subject: Fix null-pointer-dereference in hash
Bug: https://github.com/yasm/yasm/issues/175
Origin: https://github.com/yasm/yasm/pull/290
CVE: CVE-2021-33456
Upstream-Status: Submitted [https://github.com/yasm/yasm/pull/290]
Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
---
modules/preprocs/nasm/nasm-pp.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/modules/preprocs/nasm/nasm-pp.c b/modules/preprocs/nasm/nasm-pp.c
index f9f92dd1..473d98c1 100644
--- a/modules/preprocs/nasm/nasm-pp.c
+++ b/modules/preprocs/nasm/nasm-pp.c
@@ -1102,6 +1102,10 @@ hash(char *s)
{
unsigned int h = 0;
unsigned int i = 0;
+ /* Check if the input string is NULL to avoid null pointer dereference */
+ if (s == NULL) {
+ return 0;
+ }
/*
* Powers of three, mod 31.
*/

View File

@ -16,6 +16,7 @@ SRC_URI = "git://github.com/yasm/yasm.git;branch=master;protocol=https \
file://0001-bitvect-fix-build-with-gcc-15.patch \
file://CVE-2023-29579.patch \
file://CVE-2021-33464.patch \
file://CVE-2021-33456.patch \
"