71 lines
2.3 KiB
Diff
71 lines
2.3 KiB
Diff
From 1d73ed887fb7d076d6113fefc6cd53742d23bc4b Mon Sep 17 00:00:00 2001
|
|
From: Michael Mann <mmann78@netscape.net>
|
|
Date: Sat, 21 Jun 2025 12:11:30 -0400
|
|
Subject: [PATCH] Schematron: Fix null pointer dereference leading to DoS
|
|
|
|
(CVE-2025-49795)
|
|
|
|
Fixes #932
|
|
---
|
|
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 00000000..452bcc13
|
|
--- /dev/null
|
|
+++ b/result/schematron/zvon16_0.err
|
|
@@ -0,0 +1,3 @@
|
|
+XPath error : Unregistered function: falae
|
|
+./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 a8259201..86c63e64 100644
|
|
--- a/schematron.c
|
|
+++ b/schematron.c
|
|
@@ -1481,6 +1481,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 00000000..f03848aa
|
|
--- /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 00000000..551e2d65
|
|
--- /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.49.0
|
|
|