libxml2: fix CVE-2025-49795
PATCH 1/1 libxml2: fix CVE-2025-49795
From: Divya Chellam <[email protected]>
A NULL pointer dereference vulnerability was found in libxml2 when processing XPath XML expressions. This flaw allows an attacker to craft a malicious XML input to libxml2, leading to a denial of service.
Pick commit from 2.13 branch
Reference:
https://security-tracker.debian.org/tracker/CVE-2025-49795
Upstream-patch:
https://gitlab.gnome.org/GNOME/libxml2/-/commit/62048278a4c5fdf14d287dfb400005c0a0caa69f
Signed-off-by Divya Chellam <[email protected]>
--- .../libxml/libxml2/CVE-2025-49795.patch | 75 +++++++++++++++++++ meta/recipes-core/libxml/libxml2_2.13.8.bb | 1 + 2 files changed, 76 insertions(+) create mode 100644 meta/recipes-core/libxml/libxml2/CVE-2025-49795.patch
meta/recipes-core/libxml/libxml2/CVE-2025-49795.patch new file +75 -0
@@ -0,0 +1,75 @@ +From 62048278a4c5fdf14d287dfb400005c0a0caa69f Mon Sep 17 00:00:00 2001 +From: Michael Mann <[email protected]> +Date: Sat, 21 Jun 2025 12:11:30 -0400 +Subject: [PATCH] [CVE-2025-49795] schematron: Fix null pointer dereference + leading to DoS + +Fixes #932 + +CVE: CVE-2025-49795 + +Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/libxml2/-/commit/62048278a4c5fdf14d287dfb400005c0a0caa69f] + +Signed-off-by: Divya Chellam <[email protected]> +--- + result/schematron/zvon16_0.err | 3 +++ + schematron.c | 5 +++++ + test/schematron/zvon16.sct | 7 +++++++ + test/schematron/zvon16_0.xml | 5 +++++ + 4 files changed, 20 insertions(+) + create mode 100644 result/schematron/zvon16_0.err + create mode 100644 test/schematron/zvon16.sct + create mode 100644 test/schematron/zvon16_0.xml + +diff --git a/result/schematron/zvon16_0.err b/result/schematron/zvon16_0.err +new file mode 100644 +index 0000000..3d05240 +--- /dev/null ++++ b/result/schematron/zvon16_0.err +@@ -0,0 +1,3 @@ ++XPath error : Unregistered function ++./test/schematron/zvon16_0.xml:2: element book: schematron error : /library/book line 2: Book ++./test/schematron/zvon16_0.xml fails to validate +diff --git a/schematron.c b/schematron.c +index 426300c..6e2ceeb 100644 +--- a/schematron.c ++++ b/schematron.c +@@ -1509,6 +1509,11 @@ xmlSchematronFormatReport(xmlSchematronValidCtxtPtr ctxt, + select = xmlGetNoNsProp(child, BAD_CAST "select"); + comp = xmlXPathCtxtCompile(ctxt->xctxt, select); + eval = xmlXPathCompiledEval(comp, ctxt->xctxt); ++ if (eval == NULL) { ++ xmlXPathFreeCompExpr(comp); ++ xmlFree(select); ++ return ret; ++ } + + switch (eval->type) { + case XPATH_NODESET: { +diff --git a/test/schematron/zvon16.sct b/test/schematron/zvon16.sct +new file mode 100644 +index 0000000..f03848a +--- /dev/null ++++ b/test/schematron/zvon16.sct +@@ -0,0 +1,7 @@ ++<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron"> ++ <sch:pattern id="TestPattern"> ++ <sch:rule context="book"> ++ <sch:report test="not(@available)">Book <sch:value-of select="falae()"/> test</sch:report> ++ </sch:rule> ++ </sch:pattern> ++</sch:schema> +diff --git a/test/schematron/zvon16_0.xml b/test/schematron/zvon16_0.xml +new file mode 100644 +index 0000000..551e2d6 +--- /dev/null ++++ b/test/schematron/zvon16_0.xml +@@ -0,0 +1,5 @@ ++<library> ++ <book title="Test Book" id="bk101"> ++ <author>Test Author</author> ++ </book> ++</library> +-- +2.40.0 +
meta/recipes-core/libxml/libxml2_2.13.8.bb +1 -0
@@ -19,6 +19,7 @@ SRC_URI += "http://www.w3.org/XML/Test/xmlts20130923.tar;subdir=${BP};name=testt file://install-tests.patch \ file://CVE-2025-6021.patch \ file://CVE-2025-49794_CVE-2025-49796.patch \ + file://CVE-2025-49795.patch \ " SRC_URI[archive.sha256sum] = "277294cb33119ab71b2bc81f2f445e9bc9435b893ad15bb2cd2b0e859a0ee84a"
Signature · 1 line
2.40.0