summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArchana Polampalli <archana.polampalli@windriver.com>2024-09-09 06:55:58 +0000
committerSteve Sakoman <steve@sakoman.com>2024-09-16 06:09:56 -0700
commit0a757026035905cfecac210f65abda0aad8c48ee (patch)
treea55c317b0855dbb587a194bf354555fcf44f0357
parent0cc5ed6f1c5d8b42cb804b90c72abdee0cc7f6b1 (diff)
downloadpoky-0a757026035905cfecac210f65abda0aad8c48ee.tar.gz
expat: fix CVE-2024-45491
An issue was discovered in libexpat before 2.6.3. dtdCopy in xmlparse.c can have an integer overflow for nDefaultAtts on 32-bit platforms (where UINT_MAX equals SIZE_MAX). (From OE-Core rev: fb5ca8b9dcb00ff579ee70295b68aecdb3084b38) Signed-off-by: Archana Polampalli <archana.polampalli@windriver.com> Signed-off-by: Steve Sakoman <steve@sakoman.com>
-rw-r--r--meta/recipes-core/expat/expat/CVE-2024-45491.patch39
-rw-r--r--meta/recipes-core/expat/expat_2.5.0.bb1
2 files changed, 40 insertions, 0 deletions
diff --git a/meta/recipes-core/expat/expat/CVE-2024-45491.patch b/meta/recipes-core/expat/expat/CVE-2024-45491.patch
new file mode 100644
index 0000000000..2231722f12
--- /dev/null
+++ b/meta/recipes-core/expat/expat/CVE-2024-45491.patch
@@ -0,0 +1,39 @@
1From 17e29cb8ff58a8356ad8ea363c169e227e93e444 Mon Sep 17 00:00:00 2001
2From: Sebastian Pipping <sebastian@pipping.org>
3Date: Mon, 19 Aug 2024 22:34:13 +0200
4Subject: [PATCH] lib: Detect integer overflow in dtdCopy
5
6Reported by TaiYou
7
8CVE: CVE-2024-45491
9
10Upstream-Status: Backport [https://github.com/libexpat/libexpat/pull/891/commits/8e439a9947e9dc80]
11
12Signed-off-by: Archana Polampalli <archana.polampalli@windriver.com>
13---
14 lib/xmlparse.c | 10 ++++++++++
15 1 file changed, 10 insertions(+)
16
17diff --git a/lib/xmlparse.c b/lib/xmlparse.c
18index 6f0440b..adb27e3 100644
19--- a/lib/xmlparse.c
20+++ b/lib/xmlparse.c
21@@ -6913,6 +6913,16 @@ dtdCopy(XML_Parser oldParser, DTD *newDtd, const DTD *oldDtd,
22 if (! newE)
23 return 0;
24 if (oldE->nDefaultAtts) {
25+ /* Detect and prevent integer overflow.
26+ * The preprocessor guard addresses the "always false" warning
27+ * from -Wtype-limits on platforms where
28+ * sizeof(int) < sizeof(size_t), e.g. on x86_64. */
29+#if UINT_MAX >= SIZE_MAX
30+ if ((size_t)oldE->nDefaultAtts
31+ > ((size_t)(-1) / sizeof(DEFAULT_ATTRIBUTE))) {
32+ return 0;
33+ }
34+#endif
35 newE->defaultAtts
36 = ms->malloc_fcn(oldE->nDefaultAtts * sizeof(DEFAULT_ATTRIBUTE));
37 if (! newE->defaultAtts) {
38--
392.40.0
diff --git a/meta/recipes-core/expat/expat_2.5.0.bb b/meta/recipes-core/expat/expat_2.5.0.bb
index 24d5c85d74..f670f94685 100644
--- a/meta/recipes-core/expat/expat_2.5.0.bb
+++ b/meta/recipes-core/expat/expat_2.5.0.bb
@@ -26,6 +26,7 @@ SRC_URI = "https://github.com/libexpat/libexpat/releases/download/R_${VERSION_TA
26 file://CVE-2024-45490-0002.patch \ 26 file://CVE-2024-45490-0002.patch \
27 file://CVE-2024-45490-0003.patch \ 27 file://CVE-2024-45490-0003.patch \
28 file://CVE-2024-45490-0004.patch \ 28 file://CVE-2024-45490-0004.patch \
29 file://CVE-2024-45491.patch \
29 " 30 "
30 31
31UPSTREAM_CHECK_URI = "https://github.com/libexpat/libexpat/releases/" 32UPSTREAM_CHECK_URI = "https://github.com/libexpat/libexpat/releases/"