summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhongxu <hongxu.jia@eng.windriver.com>2025-06-16 13:00:53 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2025-06-16 17:57:30 +0100
commit134890aca02ec80ea54c91e42c50848eb4293145 (patch)
treec6507c0c4d4c151d55e36a44554ba3e7a632a5fc
parent32232d2ec1f32bb0de6e9bde7c7f19a470bf6d8c (diff)
downloadpoky-134890aca02ec80ea54c91e42c50848eb4293145.tar.gz
libxml2: fix CVE-2025-6021
According to [1] A flaw was found in libxml2's xmlBuildQName function, where integer overflows in buffer size calculations can lead to a stack-based buffer overflow. This issue can result in memory corruption or a denial of service when processing crafted input. Refer debian [2], backport a fix [3] from upstream [1] https://nvd.nist.gov/vuln/detail/CVE-2025-6021 [2] https://security-tracker.debian.org/tracker/CVE-2025-6021 [3] https://gitlab.gnome.org/GNOME/libxml2/-/commit/acbbeef9f5dcdcc901c5f3fa14d583ef8cfd22f0 (From OE-Core rev: e3a6bf785656243b5adc0775f7480a1eb0e4ae4c) Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-core/libxml/libxml2/CVE-2025-6021.patch59
-rw-r--r--meta/recipes-core/libxml/libxml2_2.14.3.bb1
2 files changed, 60 insertions, 0 deletions
diff --git a/meta/recipes-core/libxml/libxml2/CVE-2025-6021.patch b/meta/recipes-core/libxml/libxml2/CVE-2025-6021.patch
new file mode 100644
index 0000000000..157486848b
--- /dev/null
+++ b/meta/recipes-core/libxml/libxml2/CVE-2025-6021.patch
@@ -0,0 +1,59 @@
1From 33d7969baf541326a35e2fbe31943c46af8c71db Mon Sep 17 00:00:00 2001
2From: Nick Wellnhofer <wellnhofer@aevum.de>
3Date: Tue, 27 May 2025 12:53:17 +0200
4Subject: [PATCH] tree: Fix integer overflow in xmlBuildQName
5
6This issue affects memory safety and might receive a CVE ID later.
7
8Fixes #926.
9
10Signed-off-by: Nick Wellnhofer <wellnhofer@aevum.de>
11
12Add '#include <stdint.h>' to assure the definition of SIZE_MAX
13CVE: CVE-2025-6021
14Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/libxml2/-/commit/acbbeef9f5dcdcc901c5f3fa14d583ef8cfd22f0]
15Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
16---
17 tree.c | 9 ++++++---
18 1 file changed, 6 insertions(+), 3 deletions(-)
19
20diff --git a/tree.c b/tree.c
21index 7454b07..22ec11c 100644
22--- a/tree.c
23+++ b/tree.c
24@@ -23,6 +23,7 @@
25 #include <limits.h>
26 #include <ctype.h>
27 #include <stdlib.h>
28+#include <stdint.h>
29
30 #ifdef LIBXML_ZLIB_ENABLED
31 #include <zlib.h>
32@@ -168,10 +169,10 @@ xmlGetParameterEntityFromDtd(const xmlDtd *dtd, const xmlChar *name) {
33 xmlChar *
34 xmlBuildQName(const xmlChar *ncname, const xmlChar *prefix,
35 xmlChar *memory, int len) {
36- int lenn, lenp;
37+ size_t lenn, lenp;
38 xmlChar *ret;
39
40- if (ncname == NULL) return(NULL);
41+ if ((ncname == NULL) || (len < 0)) return(NULL);
42 if (prefix == NULL) return((xmlChar *) ncname);
43
44 #ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
45@@ -182,8 +183,10 @@ xmlBuildQName(const xmlChar *ncname, const xmlChar *prefix,
46
47 lenn = strlen((char *) ncname);
48 lenp = strlen((char *) prefix);
49+ if (lenn >= SIZE_MAX - lenp - 1)
50+ return(NULL);
51
52- if ((memory == NULL) || (len < lenn + lenp + 2)) {
53+ if ((memory == NULL) || ((size_t) len < lenn + lenp + 2)) {
54 ret = xmlMalloc(lenn + lenp + 2);
55 if (ret == NULL)
56 return(NULL);
57--
582.34.1
59
diff --git a/meta/recipes-core/libxml/libxml2_2.14.3.bb b/meta/recipes-core/libxml/libxml2_2.14.3.bb
index da75cbe450..4baab59186 100644
--- a/meta/recipes-core/libxml/libxml2_2.14.3.bb
+++ b/meta/recipes-core/libxml/libxml2_2.14.3.bb
@@ -18,6 +18,7 @@ SRC_URI += "http://www.w3.org/XML/Test/xmlts20130923.tar;subdir=${BP};name=testt
18 file://run-ptest \ 18 file://run-ptest \
19 file://install-tests.patch \ 19 file://install-tests.patch \
20 file://0001-Revert-cmake-Fix-installation-directories-in-libxml2.patch \ 20 file://0001-Revert-cmake-Fix-installation-directories-in-libxml2.patch \
21 file://CVE-2025-6021.patch \
21 " 22 "
22 23
23SRC_URI[archive.sha256sum] = "6de55cacc8c2bc758f2ef6f93c313cb30e4dd5d84ac5d3c7ccbd9344d8cc6833" 24SRC_URI[archive.sha256sum] = "6de55cacc8c2bc758f2ef6f93c313cb30e4dd5d84ac5d3c7ccbd9344d8cc6833"