mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-10-30 10:45:36 +03:00
Fix NULL pointer deref in XPointer range-to
- Check for errors after evaluating first operand. - Add sanity check for empty stack. Found with afl-fuzz.
This commit is contained in:
4
result/XPath/xptr/viderror
Normal file
4
result/XPath/xptr/viderror
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
|
||||||
|
========================
|
||||||
|
Expression: xpointer(non-existing-fn()/range-to(id('chapter2')))
|
||||||
|
Object is empty (NULL)
|
||||||
1
test/XPath/xptr/viderror
Normal file
1
test/XPath/xptr/viderror
Normal file
@@ -0,0 +1 @@
|
|||||||
|
xpointer(non-existing-fn()/range-to(id('chapter2')))
|
||||||
7
xpath.c
7
xpath.c
@@ -14005,9 +14005,14 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
|
|||||||
xmlNodeSetPtr oldset;
|
xmlNodeSetPtr oldset;
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
if (op->ch1 != -1)
|
if (op->ch1 != -1) {
|
||||||
total +=
|
total +=
|
||||||
xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
|
xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
|
||||||
|
CHECK_ERROR0;
|
||||||
|
}
|
||||||
|
if (ctxt->value == NULL) {
|
||||||
|
XP_ERROR0(XPATH_INVALID_OPERAND);
|
||||||
|
}
|
||||||
if (op->ch2 == -1)
|
if (op->ch2 == -1)
|
||||||
return (total);
|
return (total);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user