Skip to contentSkip to conversation

libxml2: add patch for CVE-2019-19956

PATCH New Rahul Taya 1 participant 1 message Jan 6, 2021

lore
Share & tools
lore

Rahul Taya

author
#0 lore raw

PATCH 1/1 libxml2: add patch for CVE-2019-19956

From: Rahul Taya <[email protected]>

Fixes memory leak.

https://security-tracker.debian.org/tracker/CVE-2019-19956
https://gitlab.gnome.org/GNOME/libxml2/commit/5a02583c7e683896d84878bd90641d8d9b0d0549

---
 .../libxml/libxml2/CVE-2019-19956.patch       | 29 +++++++++++++++++++
 meta/recipes-core/libxml/libxml2_2.9.7.bb     |  1 +
 2 files changed, 30 insertions(+)
 create mode 100644 meta/recipes-core/libxml/libxml2/CVE-2019-19956.patch
meta/recipes-core/libxml/libxml2/CVE-2019-19956.patch new file +29 -0
new file mode 100644
index 0000000000..8dd9dd82db
@@ -0,0 +1,29 @@
+Fix memory leak in xmlParseBalancedChunkMemoryRecover
+
+When doc is NULL, namespace created in xmlTreeEnsureXMLDecl
+is bind to newDoc->oldNs, in this case, set newDoc->oldNs to
+NULL and free newDoc will cause a memory leak.
+
+Found with libFuzzer.
+
+Closes #82.
+
+https://security-tracker.debian.org/tracker/CVE-2019-19956
+https://gitlab.gnome.org/GNOME/libxml2/commit/5a02583c7e683896d84878bd90641d8d9b0d0549
+
+Upstream-Status: Backport [http://security.debian.org/debian-security/pool/updates/main/libx/libxml2/libxml2_2.9.1+dfsg1-5+deb8u8.debian.tar.xz]
+
+CVE: CVE-2019-19956
+
+--- libxml2-2.9.1+dfsg1.orig/parser.c
++++ libxml2-2.9.1+dfsg1/parser.c
+@@ -13892,7 +13892,8 @@ xmlParseBalancedChunkMemoryRecover(xmlDo
+     xmlFreeParserCtxt(ctxt);
+     newDoc->intSubset = NULL;
+     newDoc->extSubset = NULL;
+-    newDoc->oldNs = NULL;
++    if(doc != NULL)
++      newDoc->oldNs = NULL;
+     xmlFreeDoc(newDoc);
+
+     return(ret);
meta/recipes-core/libxml/libxml2_2.9.7.bb +1 -0
index c749a81657..7c1fa4ceb3 100644
@@ -22,6 +22,7 @@ SRC_URI = "http://www.xmlsoft.org/sources/libxml2-${PV}.tar.gz;name=libtar \
            file://0001-Make-ptest-run-the-python-tests-if-python-is-enabled.patch \
            file://fix-execution-of-ptests.patch \
            file://CVE-2018-14404.patch \
+           file://CVE-2019-19956.patch \
            "
 
 SRC_URI[libtar.md5sum] = "896608641a08b465098a40ddf51cefba"

--
2.17.1

This message contains information that may be privileged or confidential and is the property of the KPIT Technologies Ltd. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message. KPIT Technologies Ltd. does not accept any liability for virus infected mails.