expat: fix CVE-2026-56405

This patch applies the upstream fix shown in [1] as referenced by [2].

[1] 2c6c42d336
[2] https://nvd.nist.gov/vuln/detail/CVE-2026-56405

(From OE-Core rev: 7d9b2576a9dcb01184c0aa3bd54a6bdd20496bbe)

Signed-off-by: Deepak Rathore <deeratho@cisco.com>
Signed-off-by: Fabien Thomas <fabien.thomas@smile.fr>
Signed-off-by: Paul Barker <paul@pbarker.dev>
This commit is contained in:
Deepak Rathore
2026-07-31 11:26:19 +05:30
committed by Paul Barker
parent 97081e82e0
commit 8859330d24
2 changed files with 31 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
From 49ba5bdafa7aaee9b77a32ffaa798e625bd46e73 Mon Sep 17 00:00:00 2001
From: netliomax25-code <netliomax25@gmail.com>
Date: Fri, 29 May 2026 11:45:17 +0530
Subject: [PATCH 05/17] lib: Protect function getAttributeId from signed
integer overflow
CVE: CVE-2026-56405
Upstream-Status: Backport [https://github.com/libexpat/libexpat/commit/2c6c42d33689f6b266a5267b639e03cde17e53c0]
(cherry picked from commit 2c6c42d33689f6b266a5267b639e03cde17e53c0)
Signed-off-by: Deepak Rathore <deeratho@cisco.com>
---
expat/lib/xmlparse.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/expat/lib/xmlparse.c b/expat/lib/xmlparse.c
index 9d21e136..80ad0811 100644
--- a/expat/lib/xmlparse.c
+++ b/expat/lib/xmlparse.c
@@ -7312,6 +7312,10 @@ getAttributeId(XML_Parser parser, const ENCODING *enc, const char *start,
} else {
int i;
for (i = 0; name[i]; i++) {
+ /* Detect and prevent signed integer overflow */
+ if (i == INT_MAX) {
+ return NULL;
+ }
/* attributes without prefix are *not* in the default namespace */
if (name[i] == XML_T(ASCII_COLON)) {
int j;

View File

@@ -65,6 +65,7 @@ SRC_URI = "${GITHUB_BASE_URI}/download/R_${VERSION_TAG}/expat-${PV}.tar.bz2 \
file://CVE-2026-56403_p2.patch;striplevel=2 \
file://CVE-2026-56408.patch;striplevel=2 \
file://CVE-2026-56404.patch;striplevel=2 \
file://CVE-2026-56405.patch;striplevel=2 \
"
GITHUB_BASE_URI = "https://github.com/libexpat/libexpat/releases/"