Skip to contentSkip to conversation

expat: Fix CVEs

PATCH In review Jackson James 2 participants 2 messages Jun 22

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 expat: Fix CVEs

Fix the following CVEs-
CVE-2026-32776 CVE-2026-32777 CVE-2026-32778

---
 .../expat/expat/CVE-2026-32776.patch          | 51 +++++++++++
 .../expat/expat/CVE-2026-32777.patch          | 48 ++++++++++
 .../expat/expat/CVE-2026-32778.patch          | 91 +++++++++++++++++++
 meta-core/recipes-core/expat/expat_%.bbappend |  7 ++
 4 files changed, 197 insertions(+)
 create mode 100644 meta-core/recipes-core/expat/expat/CVE-2026-32776.patch
 create mode 100644 meta-core/recipes-core/expat/expat/CVE-2026-32777.patch
 create mode 100644 meta-core/recipes-core/expat/expat/CVE-2026-32778.patch
 create mode 100644 meta-core/recipes-core/expat/expat_%.bbappend
meta-core/recipes-core/expat/expat/CVE-2026-32776.patch new file +51 -0
new file mode 100644
index 0000000..0b96fbc
@@ -0,0 +1,51 @@
+From 5be25657583ea91b09025c858b4785834c20f59c Mon Sep 17 00:00:00 2001
+From: Francesco Bertolaccini <[email protected]>
+Date: Tue, 3 Mar 2026 16:41:43 +0100
+Subject: [PATCH] Fix NULL function-pointer dereference for empty external
+ parameter entities
+
+When an external parameter entity with empty text is referenced inside
+an entity declaration value, the sub-parser created to handle it receives
+0 bytes of input.  Processing enters entityValueInitProcessor which calls
+storeEntityValue() with the parser's encoding; since no bytes were ever
+processed, encoding detection has not yet occurred and the encoding is
+still the initial probing encoding set up by XmlInitEncoding().  That
+encoding only populates scanners[] (for prolog and content), not
+literalScanners[].  XmlEntityValueTok() calls through
+literalScanners[XML_ENTITY_VALUE_LITERAL] which is NULL, causing a
+SEGV.
+
+Skip the tokenization loop entirely when entityTextPtr >= entityTextEnd,
+and initialize the `next` pointer before the early exit so that callers
+(callStoreEntityValue) receive a valid value through nextPtr.
+
+CVE: CVE-2026-32776
+Upstream-Status: Backport [https://github.com/libexpat/libexpat/commit/5be25657583ea91b09025c858b4785834c20f59c]
+
+Comment: Patch is refreshed as per codebase of 2.5.0
+Signed-off-by: Jackson James <[email protected]>
+---
+ lib/xmlparse.c | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/lib/xmlparse.c b/lib/xmlparse.c
+index 0883e2e..6a9ab7d 100644
+--- a/lib/xmlparse.c
++++ b/lib/xmlparse.c
+@@ -6194,6 +6194,13 @@ storeEntityValue(XML_Parser parser, const ENCODING *enc,
+   for (;;) {
+     const char *next
+         = entityTextPtr; /* XmlEntityValueTok doesn't always set the last arg */
++
++    /* Nothing to tokenize. */
++    if (entityTextPtr >= entityTextEnd) {
++        result = XML_ERROR_NONE;
++        goto endEntityValue;
++    }
++    
+     int tok = XmlEntityValueTok(enc, entityTextPtr, entityTextEnd, &next);
+ 
+     if (! accountingDiffTolerated(parser, tok, entityTextPtr, next, __LINE__,
+-- 
+2.34.1
+
meta-core/recipes-core/expat/expat/CVE-2026-32777.patch new file +48 -0

48 lines not on this page · raw message

meta-core/recipes-core/expat/expat/CVE-2026-32778.patch new file +91 -0

91 lines not on this page · raw message

meta-core/recipes-core/expat/expat_%.bbappend new file +7 -0
new file mode 100644
index 0000000..0a11912
@@ -0,0 +1,7 @@
+FILESEXTRAPATHS:prepend := "${THISDIR}/${BPN}:"
+
+SRC_URI:append = " \
+           file://CVE-2026-32776.patch \
+           file://CVE-2026-32777.patch \
+           file://CVE-2026-32778.patch \
+"
Signature · 1 line
2.34.1