summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/recipes-core/libxml/libxml2/CVE-2023-39615-0001.patch37
-rw-r--r--meta/recipes-core/libxml/libxml2/CVE-2023-39615-0002.patch72
-rw-r--r--meta/recipes-core/libxml/libxml2_2.9.14.bb2
3 files changed, 111 insertions, 0 deletions
diff --git a/meta/recipes-core/libxml/libxml2/CVE-2023-39615-0001.patch b/meta/recipes-core/libxml/libxml2/CVE-2023-39615-0001.patch
new file mode 100644
index 0000000000..3506779c4c
--- /dev/null
+++ b/meta/recipes-core/libxml/libxml2/CVE-2023-39615-0001.patch
@@ -0,0 +1,37 @@
1From d0c3f01e110d54415611c5fa0040cdf4a56053f9 Mon Sep 17 00:00:00 2001
2From: Nick Wellnhofer <wellnhofer@aevum.de>
3Date: Sat May 6 17:47:37 2023 +0200
4Subject: [PATCH 1/2] parser: Fix old SAX1 parser with custom callbacks
5
6For some reason, xmlCtxtUseOptionsInternal set the start and end element
7SAX handlers to the internal DOM builder functions when XML_PARSE_SAX1
8was specified. This means that custom SAX handlers could never work with
9that flag because these functions would receive the wrong user data
10argument and crash immediately.
11
12Fixes #535.
13
14CVE: CVE-2023-39615
15
16Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/libxml2/-/commit/d0c3f01e110d54415611c5fa0040cdf4a56053f9]
17
18Signed-off-by: Soumya Sambu <soumya.sambu@windriver.com>
19---
20 parser.c | 2 --
21 1 file changed, 2 deletions(-)
22
23diff --git a/parser.c b/parser.c
24index 0f76577..b781c80 100644
25--- a/parser.c
26+++ b/parser.c
27@@ -15069,8 +15069,6 @@ xmlCtxtUseOptionsInternal(xmlParserCtxtPtr ctxt, int options, const char *encodi
28 }
29 #ifdef LIBXML_SAX1_ENABLED
30 if (options & XML_PARSE_SAX1) {
31- ctxt->sax->startElement = xmlSAX2StartElement;
32- ctxt->sax->endElement = xmlSAX2EndElement;
33 ctxt->sax->startElementNs = NULL;
34 ctxt->sax->endElementNs = NULL;
35 ctxt->sax->initialized = 1;
36--
372.40.0
diff --git a/meta/recipes-core/libxml/libxml2/CVE-2023-39615-0002.patch b/meta/recipes-core/libxml/libxml2/CVE-2023-39615-0002.patch
new file mode 100644
index 0000000000..d922ddc730
--- /dev/null
+++ b/meta/recipes-core/libxml/libxml2/CVE-2023-39615-0002.patch
@@ -0,0 +1,72 @@
1From 235b15a590eecf97b09e87bdb7e4f8333e9de129 Mon Sep 17 00:00:00 2001
2From: Nick Wellnhofer <wellnhofer@aevum.de>
3Date: Mon May 8 17:58:02 2023 +0200
4Subject: [PATCH 2/2] SAX: Always initialize SAX1 element handlers
5
6Follow-up to commit d0c3f01e. A parser context will be initialized to
7SAX version 2, but this can be overridden with XML_PARSE_SAX1 later,
8so we must initialize the SAX1 element handlers as well.
9
10Change the check in xmlDetectSAX2 to only look for XML_SAX2_MAGIC, so
11we don't switch to SAX1 if the SAX2 element handlers are NULL.
12
13CVE: CVE-2023-39615
14
15Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/libxml2/-/commit/235b15a590eecf97b09e87bdb7e4f8333e9de129]
16
17Signed-off-by: Soumya Sambu <soumya.sambu@windriver.com>
18---
19 SAX2.c | 11 +++++++----
20 parser.c | 5 +----
21 2 files changed, 8 insertions(+), 8 deletions(-)
22
23diff --git a/SAX2.c b/SAX2.c
24index 0319246..f7c77c2 100644
25--- a/SAX2.c
26+++ b/SAX2.c
27@@ -2842,20 +2842,23 @@ xmlSAXVersion(xmlSAXHandler *hdlr, int version)
28 {
29 if (hdlr == NULL) return(-1);
30 if (version == 2) {
31- hdlr->startElement = NULL;
32- hdlr->endElement = NULL;
33 hdlr->startElementNs = xmlSAX2StartElementNs;
34 hdlr->endElementNs = xmlSAX2EndElementNs;
35 hdlr->serror = NULL;
36 hdlr->initialized = XML_SAX2_MAGIC;
37 #ifdef LIBXML_SAX1_ENABLED
38 } else if (version == 1) {
39- hdlr->startElement = xmlSAX2StartElement;
40- hdlr->endElement = xmlSAX2EndElement;
41 hdlr->initialized = 1;
42 #endif /* LIBXML_SAX1_ENABLED */
43 } else
44 return(-1);
45+#ifdef LIBXML_SAX1_ENABLED
46+ hdlr->startElement = xmlSAX2StartElement;
47+ hdlr->endElement = xmlSAX2EndElement;
48+#else
49+ hdlr->startElement = NULL;
50+ hdlr->endElement = NULL;
51+#endif /* LIBXML_SAX1_ENABLED */
52 hdlr->internalSubset = xmlSAX2InternalSubset;
53 hdlr->externalSubset = xmlSAX2ExternalSubset;
54 hdlr->isStandalone = xmlSAX2IsStandalone;
55diff --git a/parser.c b/parser.c
56index b781c80..738dbee 100644
57--- a/parser.c
58+++ b/parser.c
59@@ -1109,10 +1109,7 @@ xmlDetectSAX2(xmlParserCtxtPtr ctxt) {
60 if (ctxt == NULL) return;
61 sax = ctxt->sax;
62 #ifdef LIBXML_SAX1_ENABLED
63- if ((sax) && (sax->initialized == XML_SAX2_MAGIC) &&
64- ((sax->startElementNs != NULL) ||
65- (sax->endElementNs != NULL) ||
66- ((sax->startElement == NULL) && (sax->endElement == NULL))))
67+ if ((sax) && (sax->initialized == XML_SAX2_MAGIC))
68 ctxt->sax2 = 1;
69 #else
70 ctxt->sax2 = 1;
71--
722.40.0
diff --git a/meta/recipes-core/libxml/libxml2_2.9.14.bb b/meta/recipes-core/libxml/libxml2_2.9.14.bb
index 9241b279e4..437bccf4ed 100644
--- a/meta/recipes-core/libxml/libxml2_2.9.14.bb
+++ b/meta/recipes-core/libxml/libxml2_2.9.14.bb
@@ -27,6 +27,8 @@ SRC_URI += "http://www.w3.org/XML/Test/xmlts20080827.tar;subdir=${BP};name=testt
27 file://CVE-2022-40304.patch \ 27 file://CVE-2022-40304.patch \
28 file://CVE-2023-28484.patch \ 28 file://CVE-2023-28484.patch \
29 file://CVE-2023-29469.patch \ 29 file://CVE-2023-29469.patch \
30 file://CVE-2023-39615-0001.patch \
31 file://CVE-2023-39615-0002.patch \
30 " 32 "
31 33
32SRC_URI[archive.sha256sum] = "60d74a257d1ccec0475e749cba2f21559e48139efba6ff28224357c7c798dfee" 34SRC_URI[archive.sha256sum] = "60d74a257d1ccec0475e749cba2f21559e48139efba6ff28224357c7c798dfee"