Skip to contentSkip to conversation

expat: patch CVE-2026-50219

PATCH New [email protected] 1 participant 1 message Jun 5

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 expat: patch CVE-2026-50219

From: "Theo Gaige (Schneider Electric)" <[email protected]>

Backport patches from [1]

[1] https://github.com/libexpat/libexpat/pull/1246

---
 .../expat/expat/CVE-2026-50219-01.patch       |  59 +++++++
 .../expat/expat/CVE-2026-50219-02.patch       |  82 ++++++++++
 .../expat/expat/CVE-2026-50219-03.patch       |  90 +++++++++++
 .../expat/expat/CVE-2026-50219-04.patch       |  32 ++++
 .../expat/expat/CVE-2026-50219-05.patch       |  46 ++++++
 .../expat/expat/CVE-2026-50219-06.patch       | 152 ++++++++++++++++++
 .../expat/expat/CVE-2026-50219-07.patch       |  30 ++++
 .../expat/expat/CVE-2026-50219-08.patch       |  42 +++++
 .../expat/expat/CVE-2026-50219-09.patch       |  42 +++++
 .../expat/expat/CVE-2026-50219-10.patch       |  33 ++++
 .../expat/expat/CVE-2026-50219-11.patch       |  30 ++++
 .../expat/expat/CVE-2026-50219-12.patch       |  40 +++++
 .../expat/expat/CVE-2026-50219-13.patch       |  47 ++++++
 .../expat/expat/CVE-2026-50219-14.patch       |  72 +++++++++
 .../expat/expat/CVE-2026-50219-15.patch       |  80 +++++++++
 .../expat/expat/CVE-2026-50219-16.patch       |  44 +++++
 .../expat/expat/CVE-2026-50219-17.patch       |  62 +++++++
 .../expat/expat/CVE-2026-50219-18.patch       |  30 ++++
 .../expat/expat/CVE-2026-50219-19.patch       |  85 ++++++++++
 .../expat/expat/CVE-2026-50219-20.patch       |  60 +++++++
 .../expat/expat/CVE-2026-50219-21.patch       |  44 +++++
 .../expat/expat/CVE-2026-50219-22.patch       |  46 ++++++
 .../expat/expat/CVE-2026-50219-23.patch       |  34 ++++
 .../expat/expat/CVE-2026-50219-24.patch       |  31 ++++
 .../expat/expat/CVE-2026-50219-25.patch       |  33 ++++
 .../expat/expat/CVE-2026-50219-26.patch       |  31 ++++
 .../expat/expat/CVE-2026-50219-27.patch       |  29 ++++
 .../expat/expat/CVE-2026-50219-28.patch       |  29 ++++
 .../expat/expat/CVE-2026-50219-29.patch       |  29 ++++
 .../expat/expat/CVE-2026-50219-30.patch       |  29 ++++
 .../expat/expat/CVE-2026-50219-31.patch       |  29 ++++
 .../expat/expat/CVE-2026-50219-32.patch       |  97 +++++++++++
 .../expat/expat/CVE-2026-50219-33.patch       |  39 +++++
 .../expat/expat/CVE-2026-50219-34.patch       |  39 +++++
 meta/recipes-core/expat/expat_2.6.4.bb        |  34 ++++
 35 files changed, 1731 insertions(+)
 create mode 100644 meta/recipes-core/expat/expat/CVE-2026-50219-01.patch
 create mode 100644 meta/recipes-core/expat/expat/CVE-2026-50219-02.patch
 create mode 100644 meta/recipes-core/expat/expat/CVE-2026-50219-03.patch
 create mode 100644 meta/recipes-core/expat/expat/CVE-2026-50219-04.patch
 create mode 100644 meta/recipes-core/expat/expat/CVE-2026-50219-05.patch
 create mode 100644 meta/recipes-core/expat/expat/CVE-2026-50219-06.patch
 create mode 100644 meta/recipes-core/expat/expat/CVE-2026-50219-07.patch
 create mode 100644 meta/recipes-core/expat/expat/CVE-2026-50219-08.patch
 create mode 100644 meta/recipes-core/expat/expat/CVE-2026-50219-09.patch
 create mode 100644 meta/recipes-core/expat/expat/CVE-2026-50219-10.patch
 create mode 100644 meta/recipes-core/expat/expat/CVE-2026-50219-11.patch
 create mode 100644 meta/recipes-core/expat/expat/CVE-2026-50219-12.patch
 create mode 100644 meta/recipes-core/expat/expat/CVE-2026-50219-13.patch
 create mode 100644 meta/recipes-core/expat/expat/CVE-2026-50219-14.patch
 create mode 100644 meta/recipes-core/expat/expat/CVE-2026-50219-15.patch
 create mode 100644 meta/recipes-core/expat/expat/CVE-2026-50219-16.patch
 create mode 100644 meta/recipes-core/expat/expat/CVE-2026-50219-17.patch
 create mode 100644 meta/recipes-core/expat/expat/CVE-2026-50219-18.patch
 create mode 100644 meta/recipes-core/expat/expat/CVE-2026-50219-19.patch
 create mode 100644 meta/recipes-core/expat/expat/CVE-2026-50219-20.patch
 create mode 100644 meta/recipes-core/expat/expat/CVE-2026-50219-21.patch
 create mode 100644 meta/recipes-core/expat/expat/CVE-2026-50219-22.patch
 create mode 100644 meta/recipes-core/expat/expat/CVE-2026-50219-23.patch
 create mode 100644 meta/recipes-core/expat/expat/CVE-2026-50219-24.patch
 create mode 100644 meta/recipes-core/expat/expat/CVE-2026-50219-25.patch
 create mode 100644 meta/recipes-core/expat/expat/CVE-2026-50219-26.patch
 create mode 100644 meta/recipes-core/expat/expat/CVE-2026-50219-27.patch
 create mode 100644 meta/recipes-core/expat/expat/CVE-2026-50219-28.patch
 create mode 100644 meta/recipes-core/expat/expat/CVE-2026-50219-29.patch
 create mode 100644 meta/recipes-core/expat/expat/CVE-2026-50219-30.patch
 create mode 100644 meta/recipes-core/expat/expat/CVE-2026-50219-31.patch
 create mode 100644 meta/recipes-core/expat/expat/CVE-2026-50219-32.patch
 create mode 100644 meta/recipes-core/expat/expat/CVE-2026-50219-33.patch
 create mode 100644 meta/recipes-core/expat/expat/CVE-2026-50219-34.patch
meta/recipes-core/expat/expat/CVE-2026-50219-01.patch new file +59 -0
new file mode 100644
index 0000000000..52c97bf26b
@@ -0,0 +1,59 @@
+From 2225503f79c10ca8dc27cc338fbf285aa30a3808 Mon Sep 17 00:00:00 2001
+From: Sebastian Pipping <[email protected]>
+Date: Tue, 26 May 2026 15:15:10 +0200
+Subject: [PATCH 01/34] lib: Introduce handler call depth tracking
+
+CVE: CVE-2026-50219
+Upstream-Status: Backport [https://github.com/libexpat/libexpat/pull/1246/commits/f69d0719bf01596f1d95c9e902f4a279e62c6305]
+Signed-off-by: Theo Gaige (Schneider Electric) <[email protected]>
+---
+ lib/xmlparse.c | 19 +++++++++++++++++++
+ 1 file changed, 19 insertions(+)
+
+diff --git a/lib/xmlparse.c b/lib/xmlparse.c
+index 9bc67f38..e2ed3e2d 100644
+--- a/lib/xmlparse.c
++++ b/lib/xmlparse.c
+@@ -784,6 +784,7 @@ struct XML_ParserStruct {
+   ENTITY_STATS m_entity_stats;
+ #endif
+   XML_Bool m_reenter;
++  unsigned m_handlerCallDepth;
+ };
+ 
+ #if XML_GE == 1
+@@ -1248,6 +1249,23 @@ get_hash_secret_salt(XML_Parser parser) {
+   return parser->m_hash_secret_salt;
+ }
+ 
++static void
++beforeHandler(XML_Parser parser) {
++  assert(parser->m_handlerCallDepth < UINT_MAX);
++  parser->m_handlerCallDepth++;
++}
++
++static void
++afterHandler(XML_Parser parser) {
++  assert(parser->m_handlerCallDepth > 0);
++  parser->m_handlerCallDepth--;
++}
++
++static bool
++isCalledFromInsideHandler(XML_Parser parser) {
++  return parser->m_handlerCallDepth > 0;
++}
++
+ static enum XML_Error
+ callProcessor(XML_Parser parser, const char *start, const char *end,
+               const char **endPtr) {
+@@ -1600,6 +1618,7 @@ parserInit(XML_Parser parser, const XML_Char *encodingName) {
+   parser->m_parsingStatus.parsing = XML_INITIALIZED;
+   // Reentry can only be triggered inside m_processor calls
+   parser->m_reenter = XML_FALSE;
++  parser->m_handlerCallDepth = 0;
+ #ifdef XML_DTD
+   parser->m_isParamEntity = XML_FALSE;
+   parser->m_useForeignDTD = XML_FALSE;
+-- 
+2.43.0
+
meta/recipes-core/expat/expat/CVE-2026-50219-02.patch new file +82 -0

82 lines not on this page · raw message

meta/recipes-core/expat/expat/CVE-2026-50219-03.patch new file +90 -0

90 lines not on this page · raw message

meta/recipes-core/expat/expat/CVE-2026-50219-04.patch new file +32 -0
new file mode 100644
index 0000000000..a36f96e16f
@@ -0,0 +1,32 @@
+From 8d7a4bd5734d401a29f912365e80ee6900f2d877 Mon Sep 17 00:00:00 2001
+From: Sebastian Pipping <[email protected]>
+Date: Sat, 30 May 2026 00:46:36 +0200
+Subject: [PATCH 04/34] lib: Prepare `m_unknownEncodingHandler` calls for
+ upcoming wrapping
+
+CVE: CVE-2026-50219
+Upstream-Status: Backport [https://github.com/libexpat/libexpat/pull/1246/commits/adcafd4316259ef48b1763e584733a7bff4a8db0]
+Signed-off-by: Theo Gaige (Schneider Electric) <[email protected]>
+---
+ lib/xmlparse.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/lib/xmlparse.c b/lib/xmlparse.c
+index 07f63928..c5aad0dc 100644
+--- a/lib/xmlparse.c
++++ b/lib/xmlparse.c
+@@ -4970,8 +4970,9 @@ handleUnknownEncoding(XML_Parser parser, const XML_Char *encodingName) {
+     info.convert = NULL;
+     info.data = NULL;
+     info.release = NULL;
+-    if (parser->m_unknownEncodingHandler(parser->m_unknownEncodingHandlerData,
+-                                         encodingName, &info)) {
++    const int status = parser->m_unknownEncodingHandler(
++        parser->m_unknownEncodingHandlerData, encodingName, &info);
++    if (status) {
+       ENCODING *enc;
+       parser->m_unknownEncodingMem = MALLOC(parser, XmlSizeOfUnknownEncoding());
+       if (! parser->m_unknownEncodingMem) {
+-- 
+2.43.0
+
meta/recipes-core/expat/expat/CVE-2026-50219-05.patch new file +46 -0

46 lines not on this page · raw message

meta/recipes-core/expat/expat/CVE-2026-50219-06.patch new file +152 -0

152 lines not on this page · raw message

meta/recipes-core/expat/expat/CVE-2026-50219-07.patch new file +30 -0
new file mode 100644
index 0000000000..35928cdbfd
@@ -0,0 +1,30 @@
+From e4c15c4600f0a50fd03b4e23cb79c89a2ce6faa9 Mon Sep 17 00:00:00 2001
+From: Sebastian Pipping <[email protected]>
+Date: Tue, 26 May 2026 21:08:40 +0200
+Subject: [PATCH 07/34] lib: Register `m_commentHandler` with handler call
+ depth tracking
+
+CVE: CVE-2026-50219
+Upstream-Status: Backport [https://github.com/libexpat/libexpat/pull/1246/commits/0e7dbfee7912a8e25aace775be47e5ad570b9cc3]
+Signed-off-by: Theo Gaige (Schneider Electric) <[email protected]>
+---
+ lib/xmlparse.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/lib/xmlparse.c b/lib/xmlparse.c
+index 480d9672..d1258b81 100644
+--- a/lib/xmlparse.c
++++ b/lib/xmlparse.c
+@@ -7178,7 +7178,9 @@ reportComment(XML_Parser parser, const ENCODING *enc, const char *start,
+   if (! data)
+     return 0;
+   normalizeLines(data);
++  beforeHandler(parser);
+   parser->m_commentHandler(parser->m_handlerArg, data);
++  afterHandler(parser);
+   poolClear(&parser->m_tempPool);
+   return 1;
+ }
+-- 
+2.43.0
+
meta/recipes-core/expat/expat/CVE-2026-50219-08.patch new file +42 -0

42 lines not on this page · raw message

meta/recipes-core/expat/expat/CVE-2026-50219-09.patch new file +42 -0

42 lines not on this page · raw message

meta/recipes-core/expat/expat/CVE-2026-50219-10.patch new file +33 -0
new file mode 100644
index 0000000000..9aac151867
@@ -0,0 +1,33 @@
+From 2c3ffbacf4dbe1e71da7ba2bac347ffcca278597 Mon Sep 17 00:00:00 2001
+From: Sebastian Pipping <[email protected]>
+Date: Tue, 26 May 2026 21:15:40 +0200
+Subject: [PATCH 10/34] lib: Register `m_endCdataSectionHandler` with handler
+ call depth tracking
+
+CVE: CVE-2026-50219
+Upstream-Status: Backport [https://github.com/libexpat/libexpat/pull/1246/commits/b08e08c0558152a4180597a3e880dc70040c2b2a]
+Signed-off-by: Theo Gaige (Schneider Electric) <[email protected]>
+---
+ lib/xmlparse.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/lib/xmlparse.c b/lib/xmlparse.c
+index 3ff60ce4..61890253 100644
+--- a/lib/xmlparse.c
++++ b/lib/xmlparse.c
+@@ -4659,8 +4659,11 @@ doCdataSection(XML_Parser parser, const ENCODING *enc, const char **startPtr,
+     *eventEndPP = next;
+     switch (tok) {
+     case XML_TOK_CDATA_SECT_CLOSE:
+-      if (parser->m_endCdataSectionHandler)
++      if (parser->m_endCdataSectionHandler) {
++        beforeHandler(parser);
+         parser->m_endCdataSectionHandler(parser->m_handlerArg);
++        afterHandler(parser);
++      }
+       /* BEGIN disabled code */
+       /* see comment under XML_TOK_CDATA_SECT_OPEN */
+       else if ((0) && parser->m_characterDataHandler) {
+-- 
+2.43.0
+
meta/recipes-core/expat/expat/CVE-2026-50219-11.patch new file +30 -0
new file mode 100644
index 0000000000..bbb291bf79
@@ -0,0 +1,30 @@
+From c5d62ac8641754fc5c176c15afe0314b0ddb8778 Mon Sep 17 00:00:00 2001
+From: Sebastian Pipping <[email protected]>
+Date: Tue, 26 May 2026 21:16:13 +0200
+Subject: [PATCH 11/34] lib: Register `m_endDoctypeDeclHandler` with handler
+ call depth tracking
+
+CVE: CVE-2026-50219
+Upstream-Status: Backport [https://github.com/libexpat/libexpat/pull/1246/commits/bd454febe07b931e638f2186755585b67a738d31]
+Signed-off-by: Theo Gaige (Schneider Electric) <[email protected]>
+---
+ lib/xmlparse.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/lib/xmlparse.c b/lib/xmlparse.c
+index 61890253..9d8d9de9 100644
+--- a/lib/xmlparse.c
++++ b/lib/xmlparse.c
+@@ -5498,7 +5498,9 @@ doProlog(XML_Parser parser, const ENCODING *enc, const char *s, const char *end,
+       }
+ #endif /* XML_DTD */
+       if (parser->m_endDoctypeDeclHandler) {
++        beforeHandler(parser);
+         parser->m_endDoctypeDeclHandler(parser->m_handlerArg);
++        afterHandler(parser);
+         handleDefault = XML_FALSE;
+       }
+       break;
+-- 
+2.43.0
+
meta/recipes-core/expat/expat/CVE-2026-50219-12.patch new file +40 -0
new file mode 100644
index 0000000000..0ee5a143d0
@@ -0,0 +1,40 @@
+From 9510f4cec802ea02c6766e34e823ba4f00d1e4b7 Mon Sep 17 00:00:00 2001
+From: Sebastian Pipping <[email protected]>
+Date: Tue, 26 May 2026 21:17:10 +0200
+Subject: [PATCH 12/34] lib: Register `m_endElementHandler` with handler call
+ depth tracking
+
+CVE: CVE-2026-50219
+Upstream-Status: Backport [https://github.com/libexpat/libexpat/pull/1246/commits/e411d9907b8addb334d1ed5db1afd5b5bf625f24]
+Signed-off-by: Theo Gaige (Schneider Electric) <[email protected]>
+---
+ lib/xmlparse.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/lib/xmlparse.c b/lib/xmlparse.c
+index 9d8d9de9..9e95b284 100644
+--- a/lib/xmlparse.c
++++ b/lib/xmlparse.c
+@@ -3579,7 +3579,9 @@ doContent(XML_Parser parser, int startTagLevel, const ENCODING *enc,
+       if (parser->m_endElementHandler) {
+         if (parser->m_startElementHandler)
+           *eventPP = *eventEndPP;
++        beforeHandler(parser);
+         parser->m_endElementHandler(parser->m_handlerArg, name.str);
++        afterHandler(parser);
+         noElmHandlers = XML_FALSE;
+       }
+       if (noElmHandlers && parser->m_defaultHandler)
+@@ -3637,7 +3639,9 @@ doContent(XML_Parser parser, int startTagLevel, const ENCODING *enc,
+             }
+             *uri = XML_T('\0');
+           }
++          beforeHandler(parser);
+           parser->m_endElementHandler(parser->m_handlerArg, tag->name.str);
++          afterHandler(parser);
+         } else if (parser->m_defaultHandler)
+           reportDefault(parser, enc, s, next);
+         while (tag->bindings) {
+-- 
+2.43.0
+
meta/recipes-core/expat/expat/CVE-2026-50219-13.patch new file +47 -0

47 lines not on this page · raw message

meta/recipes-core/expat/expat/CVE-2026-50219-14.patch new file +72 -0

72 lines not on this page · raw message

meta/recipes-core/expat/expat/CVE-2026-50219-15.patch new file +80 -0

80 lines not on this page · raw message

meta/recipes-core/expat/expat/CVE-2026-50219-16.patch new file +44 -0

44 lines not on this page · raw message

meta/recipes-core/expat/expat/CVE-2026-50219-17.patch new file +62 -0

62 lines not on this page · raw message

meta/recipes-core/expat/expat/CVE-2026-50219-18.patch new file +30 -0
new file mode 100644
index 0000000000..6ce48b881a
@@ -0,0 +1,30 @@
+From 66b312e7ff31f5c824863210ca70710d7b200011 Mon Sep 17 00:00:00 2001
+From: Sebastian Pipping <[email protected]>
+Date: Tue, 26 May 2026 21:35:08 +0200
+Subject: [PATCH 18/34] lib: Register `m_processingInstructionHandler` with
+ handler call depth tracking
+
+CVE: CVE-2026-50219
+Upstream-Status: Backport [https://github.com/libexpat/libexpat/pull/1246/commits/8bb00d345d5f92b17a06e01a926ee1dda797e0af]
+Signed-off-by: Theo Gaige (Schneider Electric) <[email protected]>
+---
+ lib/xmlparse.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/lib/xmlparse.c b/lib/xmlparse.c
+index 4c4708d5..407d7e0d 100644
+--- a/lib/xmlparse.c
++++ b/lib/xmlparse.c
+@@ -7207,7 +7207,9 @@ reportProcessingInstruction(XML_Parser parser, const ENCODING *enc,
+   if (! data)
+     return 0;
+   normalizeLines(data);
++  beforeHandler(parser);
+   parser->m_processingInstructionHandler(parser->m_handlerArg, target, data);
++  afterHandler(parser);
+   poolClear(&parser->m_tempPool);
+   return 1;
+ }
+-- 
+2.43.0
+
meta/recipes-core/expat/expat/CVE-2026-50219-19.patch new file +85 -0

85 lines not on this page · raw message

meta/recipes-core/expat/expat/CVE-2026-50219-20.patch new file +60 -0

60 lines not on this page · raw message

meta/recipes-core/expat/expat/CVE-2026-50219-21.patch new file +44 -0

44 lines not on this page · raw message

meta/recipes-core/expat/expat/CVE-2026-50219-22.patch new file +46 -0

46 lines not on this page · raw message

meta/recipes-core/expat/expat/CVE-2026-50219-23.patch new file +34 -0
new file mode 100644
index 0000000000..69b5dd6b2a
@@ -0,0 +1,34 @@
+From bbdf4565ffc47aba55fea3379245d01e626dd229 Mon Sep 17 00:00:00 2001
+From: Sebastian Pipping <[email protected]>
+Date: Tue, 26 May 2026 21:40:13 +0200
+Subject: [PATCH 23/34] lib: Register `m_startNamespaceDeclHandler` with
+ handler call depth tracking
+
+CVE: CVE-2026-50219
+Upstream-Status: Backport [https://github.com/libexpat/libexpat/pull/1246/commits/ddd0238420113c97594083194e517e8bc742700c]
+Signed-off-by: Theo Gaige (Schneider Electric) <[email protected]>
+---
+ lib/xmlparse.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/lib/xmlparse.c b/lib/xmlparse.c
+index 70f01e95..1ae77aae 100644
+--- a/lib/xmlparse.c
++++ b/lib/xmlparse.c
+@@ -4617,9 +4617,12 @@ addBinding(XML_Parser parser, PREFIX *prefix, const ATTRIBUTE_ID *attId,
+   b->nextTagBinding = *bindingsPtr;
+   *bindingsPtr = b;
+   /* if attId == NULL then we are not starting a namespace scope */
+-  if (attId && parser->m_startNamespaceDeclHandler)
++  if (attId && parser->m_startNamespaceDeclHandler) {
++    beforeHandler(parser);
+     parser->m_startNamespaceDeclHandler(parser->m_handlerArg, prefix->name,
+                                         prefix->binding ? uri : 0);
++    afterHandler(parser);
++  }
+   return XML_ERROR_NONE;
+ }
+ 
+-- 
+2.43.0
+
meta/recipes-core/expat/expat/CVE-2026-50219-24.patch new file +31 -0
new file mode 100644
index 0000000000..5e83b776c4
@@ -0,0 +1,31 @@
+From e763c4db3ea639bc435ca7eaf5ae94ae4beed17b Mon Sep 17 00:00:00 2001
+From: Sebastian Pipping <[email protected]>
+Date: Sat, 30 May 2026 00:46:47 +0200
+Subject: [PATCH 24/34] lib: Register `m_unknownEncodingHandler` with handler
+ call depth tracking
+
+CVE: CVE-2026-50219
+Upstream-Status: Backport [https://github.com/libexpat/libexpat/pull/1246/commits/f66d83c9aecaa802174f95a1348a89f56e3b9441]
+Signed-off-by: Theo Gaige (Schneider Electric) <[email protected]>
+---
+ lib/xmlparse.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/lib/xmlparse.c b/lib/xmlparse.c
+index 1ae77aae..9c5433cc 100644
+--- a/lib/xmlparse.c
++++ b/lib/xmlparse.c
+@@ -5022,8 +5022,10 @@ handleUnknownEncoding(XML_Parser parser, const XML_Char *encodingName) {
+     info.convert = NULL;
+     info.data = NULL;
+     info.release = NULL;
++    beforeHandler(parser);
+     const int status = parser->m_unknownEncodingHandler(
+         parser->m_unknownEncodingHandlerData, encodingName, &info);
++    afterHandler(parser);
+     if (status) {
+       ENCODING *enc;
+       parser->m_unknownEncodingMem = MALLOC(parser, XmlSizeOfUnknownEncoding());
+-- 
+2.43.0
+
meta/recipes-core/expat/expat/CVE-2026-50219-25.patch new file +33 -0
new file mode 100644
index 0000000000..9c0370a3c9
@@ -0,0 +1,33 @@
+From be50a6cd7ac802c27f370c0b9c61920738b33f94 Mon Sep 17 00:00:00 2001
+From: Sebastian Pipping <[email protected]>
+Date: Tue, 26 May 2026 21:41:00 +0200
+Subject: [PATCH 25/34] lib: Register `m_unparsedEntityDeclHandler` with
+ handler call depth tracking
+
+CVE: CVE-2026-50219
+Upstream-Status: Backport [https://github.com/libexpat/libexpat/pull/1246/commits/6e7c5af75a743c609fdb35627554cc7e940e6593]
+Signed-off-by: Theo Gaige (Schneider Electric) <[email protected]>
+---
+ lib/xmlparse.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/lib/xmlparse.c b/lib/xmlparse.c
+index 9c5433cc..ea29489e 100644
+--- a/lib/xmlparse.c
++++ b/lib/xmlparse.c
+@@ -5855,10 +5855,12 @@ doProlog(XML_Parser parser, const ENCODING *enc, const char *s, const char *end,
+         poolFinish(&dtd->pool);
+         if (parser->m_unparsedEntityDeclHandler) {
+           *eventEndPP = s;
++          beforeHandler(parser);
+           parser->m_unparsedEntityDeclHandler(
+               parser->m_handlerArg, parser->m_declEntity->name,
+               parser->m_declEntity->base, parser->m_declEntity->systemId,
+               parser->m_declEntity->publicId, parser->m_declEntity->notation);
++          afterHandler(parser);
+           handleDefault = XML_FALSE;
+         } else if (parser->m_entityDeclHandler) {
+           *eventEndPP = s;
+-- 
+2.43.0
+
meta/recipes-core/expat/expat/CVE-2026-50219-26.patch new file +31 -0
new file mode 100644
index 0000000000..0e87a361f6
@@ -0,0 +1,31 @@
+From 9e21ad00545e6ea8a02773d4565eb3b2b16eb171 Mon Sep 17 00:00:00 2001
+From: Sebastian Pipping <[email protected]>
+Date: Tue, 26 May 2026 21:41:38 +0200
+Subject: [PATCH 26/34] lib: Register `m_xmlDeclHandler` with handler call
+ depth tracking
+
+CVE: CVE-2026-50219
+Upstream-Status: Backport [https://github.com/libexpat/libexpat/pull/1246/commits/91484ffb98ec138df79265e431a55823bc80c6c4]
+Signed-off-by: Theo Gaige (Schneider Electric) <[email protected]>
+---
+ lib/xmlparse.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/lib/xmlparse.c b/lib/xmlparse.c
+index ea29489e..f1ba05cc 100644
+--- a/lib/xmlparse.c
++++ b/lib/xmlparse.c
+@@ -4971,8 +4971,10 @@ processXmlDecl(XML_Parser parser, int isGeneralTextEntity, const char *s,
+       if (! storedversion)
+         return XML_ERROR_NO_MEMORY;
+     }
++    beforeHandler(parser);
+     parser->m_xmlDeclHandler(parser->m_handlerArg, storedversion, storedEncName,
+                              standalone);
++    afterHandler(parser);
+   } else if (parser->m_defaultHandler)
+     reportDefault(parser, parser->m_encoding, s, next);
+   if (parser->m_protocolEncodingName == NULL) {
+-- 
+2.43.0
+
meta/recipes-core/expat/expat/CVE-2026-50219-27.patch new file +29 -0
new file mode 100644
index 0000000000..3f4b1ec9ed
@@ -0,0 +1,29 @@
+From 98218922a1bc94d6eb8371fb7f18abf0e2a76f08 Mon Sep 17 00:00:00 2001
+From: Sebastian Pipping <[email protected]>
+Date: Tue, 26 May 2026 15:35:27 +0200
+Subject: [PATCH 27/34] lib: Protect `XML_GetBuffer` from being called from a
+ handler
+
+CVE: CVE-2026-50219
+Upstream-Status: Backport [https://github.com/libexpat/libexpat/pull/1246/commits/5d90d1aebfe606af2550e92983cbe121d7eda032]
+Signed-off-by: Theo Gaige (Schneider Electric) <[email protected]>
+---
+ lib/xmlparse.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/lib/xmlparse.c b/lib/xmlparse.c
+index f1ba05cc..e7642d8f 100644
+--- a/lib/xmlparse.c
++++ b/lib/xmlparse.c
+@@ -2533,7 +2533,7 @@ XML_ParseBuffer(XML_Parser parser, int len, int isFinal) {
+ 
+ void *XMLCALL
+ XML_GetBuffer(XML_Parser parser, int len) {
+-  if (parser == NULL)
++  if ((parser == NULL) || isCalledFromInsideHandler(parser))
+     return NULL;
+   if (len < 0) {
+     parser->m_errorCode = XML_ERROR_NO_MEMORY;
+-- 
+2.43.0
+
meta/recipes-core/expat/expat/CVE-2026-50219-28.patch new file +29 -0
new file mode 100644
index 0000000000..f9564ec175
@@ -0,0 +1,29 @@
+From df1172fd2bc3e3be5319e788cb99867bebe6d3c5 Mon Sep 17 00:00:00 2001
+From: Sebastian Pipping <[email protected]>
+Date: Tue, 26 May 2026 15:32:38 +0200
+Subject: [PATCH 28/34] lib: Protect `XML_Parse` from being called from a
+ handler
+
+CVE: CVE-2026-50219
+Upstream-Status: Backport [https://github.com/libexpat/libexpat/pull/1246/commits/b59f1865e6c0c0ab2c1623b9dfd53aa6fb85bb96]
+Signed-off-by: Theo Gaige (Schneider Electric) <[email protected]>
+---
+ lib/xmlparse.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/lib/xmlparse.c b/lib/xmlparse.c
+index e7642d8f..7234cc89 100644
+--- a/lib/xmlparse.c
++++ b/lib/xmlparse.c
+@@ -2356,6 +2356,8 @@ XML_Parse(XML_Parser parser, const char *s, int len, int isFinal) {
+       parser->m_errorCode = XML_ERROR_INVALID_ARGUMENT;
+     return XML_STATUS_ERROR;
+   }
++  if (isCalledFromInsideHandler(parser))
++    return XML_STATUS_ERROR;
+   switch (parser->m_parsingStatus.parsing) {
+   case XML_SUSPENDED:
+     parser->m_errorCode = XML_ERROR_SUSPENDED;
+-- 
+2.43.0
+
meta/recipes-core/expat/expat/CVE-2026-50219-29.patch new file +29 -0
new file mode 100644
index 0000000000..d67bb1462b
@@ -0,0 +1,29 @@
+From dccaa02c0193fbc5fdc0cf5991fa6d1400715fc8 Mon Sep 17 00:00:00 2001
+From: Sebastian Pipping <[email protected]>
+Date: Tue, 26 May 2026 15:33:44 +0200
+Subject: [PATCH 29/34] lib: Protect `XML_ParseBuffer` from being called from a
+ handler
+
+CVE: CVE-2026-50219
+Upstream-Status: Backport [https://github.com/libexpat/libexpat/pull/1246/commits/ef3267d5f8157862e33d87c45c6fe82ac26e557f]
+Signed-off-by: Theo Gaige (Schneider Electric) <[email protected]>
+---
+ lib/xmlparse.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/lib/xmlparse.c b/lib/xmlparse.c
+index 7234cc89..769eb10a 100644
+--- a/lib/xmlparse.c
++++ b/lib/xmlparse.c
+@@ -2467,7 +2467,7 @@ XML_ParseBuffer(XML_Parser parser, int len, int isFinal) {
+   const char *start;
+   enum XML_Status result = XML_STATUS_OK;
+ 
+-  if (parser == NULL)
++  if ((parser == NULL) || isCalledFromInsideHandler(parser))
+     return XML_STATUS_ERROR;
+ 
+   if (len < 0) {
+-- 
+2.43.0
+
meta/recipes-core/expat/expat/CVE-2026-50219-30.patch new file +29 -0
new file mode 100644
index 0000000000..57dca36e6a
@@ -0,0 +1,29 @@
+From c905fb91906554ed8132c2b11738c2bbdcafaf42 Mon Sep 17 00:00:00 2001
+From: Sebastian Pipping <[email protected]>
+Date: Tue, 26 May 2026 15:21:28 +0200
+Subject: [PATCH 30/34] lib: Protect `XML_ParserFree` from being called from a
+ handler
+
+CVE: CVE-2026-50219
+Upstream-Status: Backport [https://github.com/libexpat/libexpat/pull/1246/commits/827fbddcaaa8ba2171ef76a3223d6f403388635c]
+Signed-off-by: Theo Gaige (Schneider Electric) <[email protected]>
+---
+ lib/xmlparse.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/lib/xmlparse.c b/lib/xmlparse.c
+index 769eb10a..4d2cedac 100644
+--- a/lib/xmlparse.c
++++ b/lib/xmlparse.c
+@@ -1939,7 +1939,7 @@ void XMLCALL
+ XML_ParserFree(XML_Parser parser) {
+   TAG *tagList;
+   OPEN_INTERNAL_ENTITY *entityList;
+-  if (parser == NULL)
++  if ((parser == NULL) || isCalledFromInsideHandler(parser))
+     return;
+   /* free m_tagStack and m_freeTagList */
+   tagList = parser->m_tagStack;
+-- 
+2.43.0
+
meta/recipes-core/expat/expat/CVE-2026-50219-31.patch new file +29 -0
new file mode 100644
index 0000000000..de693a448c
@@ -0,0 +1,29 @@
+From 9e9a6f2de2b9bd399011dd1685b235e0c580f312 Mon Sep 17 00:00:00 2001
+From: Sebastian Pipping <[email protected]>
+Date: Tue, 26 May 2026 15:22:41 +0200
+Subject: [PATCH 31/34] lib: Protect `XML_ParserReset` from being called from a
+ handler
+
+CVE: CVE-2026-50219
+Upstream-Status: Backport [https://github.com/libexpat/libexpat/pull/1246/commits/34bc7e080a1b432ad9d6879a6c718f2d6f12fa22]
+Signed-off-by: Theo Gaige (Schneider Electric) <[email protected]>
+---
+ lib/xmlparse.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/lib/xmlparse.c b/lib/xmlparse.c
+index 4d2cedac..0294d71f 100644
+--- a/lib/xmlparse.c
++++ b/lib/xmlparse.c
+@@ -1655,7 +1655,7 @@ XML_ParserReset(XML_Parser parser, const XML_Char *encodingName) {
+   TAG *tStk;
+   OPEN_INTERNAL_ENTITY *openEntityList;
+ 
+-  if (parser == NULL)
++  if ((parser == NULL) || isCalledFromInsideHandler(parser))
+     return XML_FALSE;
+ 
+   if (parser->m_parentParser)
+-- 
+2.43.0
+
meta/recipes-core/expat/expat/CVE-2026-50219-32.patch new file +97 -0

97 lines not on this page · raw message

meta/recipes-core/expat/expat/CVE-2026-50219-33.patch new file +39 -0
new file mode 100644
index 0000000000..dda72a311e
@@ -0,0 +1,39 @@
+From ea59c2c53276eb44526244def65a7be8f0d617ac Mon Sep 17 00:00:00 2001
+From: Sebastian Pipping <[email protected]>
+Date: Tue, 26 May 2026 15:41:46 +0200
+Subject: [PATCH 33/34] doc: Document that `XML_ParserFree` and
+ `XML_ParserReset` must not
+
+.. be called from within handlers for the same parser instance
+
+CVE: CVE-2026-50219
+Upstream-Status: Backport [https://github.com/libexpat/libexpat/pull/1246/commits/cdeb65e1c4570861ce91c529e934a1f1d9629b3f]
+Signed-off-by: Theo Gaige (Schneider Electric) <[email protected]>
+---
+ doc/reference.html | 10 ++++++----
+ 1 file changed, 6 insertions(+), 4 deletions(-)
+
+diff --git a/doc/reference.html b/doc/reference.html
+index 8f14b011..fad5e1ab 100644
+--- a/doc/reference.html
++++ b/doc/reference.html
+@@ -1095,10 +1095,12 @@ dealing with any memory associated with <a href="#userdata">user data</a>.
+ <p>To state the obvious: the three parsing functions <code><a href=
+ "#XML_Parse" >XML_Parse</a></code>, <code><a href= "#XML_ParseBuffer">
+ XML_ParseBuffer</a></code> and <code><a href= "#XML_GetBuffer">
+-XML_GetBuffer</a></code> must not be called from within a handler
+-unless they operate on a separate parser instance, that is, one that
+-did not call the handler. For example, it is OK to call the parsing
+-functions from within an <code>XML_ExternalEntityRefHandler</code>,
++XML_GetBuffer</a></code> as well as the two cleanup functions <code><a
++href="#XML_ParserFree">XML_ParserFree</a></code> and <code><a href=
++"#XML_ParserReset">XML_ParserReset</a></code> must not be called from
++within a handler unless they operate on a separate parser instance, that
++is, one that did not call the handler. For example, it is OK to call the
++parsing functions from within an <code>XML_ExternalEntityRefHandler</code>,
+ if they apply to the parser created by
+ <code><a href= "#XML_ExternalEntityParserCreate"
+ >XML_ExternalEntityParserCreate</a></code>.</p>
+-- 
+2.43.0
+
meta/recipes-core/expat/expat/CVE-2026-50219-34.patch new file +39 -0
new file mode 100644
index 0000000000..54a512d621
@@ -0,0 +1,39 @@
+From bcb2de3b2b03bb67c892dc3c6ac51795c5fb50a5 Mon Sep 17 00:00:00 2001
+From: Sebastian Pipping <[email protected]>
+Date: Sun, 31 May 2026 14:01:51 +0200
+Subject: [PATCH 34/34] Changes: Document CVE-2026-50219
+
+CVE: CVE-2026-50219
+Upstream-Status: Backport [https://github.com/libexpat/libexpat/pull/1246/commits/f17ca46befb59098da339ed6d2438de3bdece8b5]
+Signed-off-by: Theo Gaige (Schneider Electric) <[email protected]>
+---
+ Changes | 13 +++++++++++++
+ 1 file changed, 13 insertions(+)
+
+diff --git a/Changes b/Changes
+index 4265d608..b8755c15 100644
+--- a/Changes
++++ b/Changes
+@@ -30,6 +30,19 @@
+ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ 
+ Patches:
++        Security fixes:
++           #1246  CVE-2026-50219 -- Disallow calls to functions
++                    `XML_GetBuffer`, `XML_Parse`, `XML_ParseBuffer`,
++                    `XML_ParserFree`, `XML_ParserReset` to guard e.g.
++                    Expat bindings from memory corruption;
++                    this CPython issue is related:
++                    https://github.com/python/cpython/issues/146169
++
++        Special thanks to:
++            Asher Darden
++            Matthew Fernandez
++            Yousef Shanableh
++
+         Security fixes:
+      #1018 #1034  CVE-2025-59375 -- Disallow use of disproportional amounts of
+                     dynamic memory from within an Expat parser (e.g. previously
+-- 
+2.43.0
+
meta/recipes-core/expat/expat_2.6.4.bb +34 -0
index 151720a9e3..cda545d624 100644
@@ -51,6 +51,40 @@ SRC_URI = "${GITHUB_BASE_URI}/download/R_${VERSION_TAG}/expat-${PV}.tar.bz2  \
            file://CVE-2026-32777-02.patch \
            file://CVE-2026-32778-01.patch \
            file://CVE-2026-32778-02.patch \
+           file://CVE-2026-50219-01.patch \
+           file://CVE-2026-50219-02.patch \
+           file://CVE-2026-50219-03.patch \
+           file://CVE-2026-50219-04.patch \
+           file://CVE-2026-50219-05.patch \
+           file://CVE-2026-50219-06.patch \
+           file://CVE-2026-50219-07.patch \
+           file://CVE-2026-50219-08.patch \
+           file://CVE-2026-50219-09.patch \
+           file://CVE-2026-50219-10.patch \
+           file://CVE-2026-50219-11.patch \
+           file://CVE-2026-50219-12.patch \
+           file://CVE-2026-50219-13.patch \
+           file://CVE-2026-50219-14.patch \
+           file://CVE-2026-50219-15.patch \
+           file://CVE-2026-50219-16.patch \
+           file://CVE-2026-50219-17.patch \
+           file://CVE-2026-50219-18.patch \
+           file://CVE-2026-50219-19.patch \
+           file://CVE-2026-50219-20.patch \
+           file://CVE-2026-50219-21.patch \
+           file://CVE-2026-50219-22.patch \
+           file://CVE-2026-50219-23.patch \
+           file://CVE-2026-50219-24.patch \
+           file://CVE-2026-50219-25.patch \
+           file://CVE-2026-50219-26.patch \
+           file://CVE-2026-50219-27.patch \
+           file://CVE-2026-50219-28.patch \
+           file://CVE-2026-50219-29.patch \
+           file://CVE-2026-50219-30.patch \
+           file://CVE-2026-50219-31.patch \
+           file://CVE-2026-50219-32.patch \
+           file://CVE-2026-50219-33.patch \
+           file://CVE-2026-50219-34.patch \
            "
 
 GITHUB_BASE_URI = "https://github.com/libexpat/libexpat/releases/"
Signature · 1 line
2.43.0