mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-03-24 06:50:08 +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:
parent
1fc55ca72b
commit
d8083bf779
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;
|
||||
int i, j;
|
||||
|
||||
if (op->ch1 != -1)
|
||||
if (op->ch1 != -1) {
|
||||
total +=
|
||||
xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
|
||||
CHECK_ERROR0;
|
||||
}
|
||||
if (ctxt->value == NULL) {
|
||||
XP_ERROR0(XPATH_INVALID_OPERAND);
|
||||
}
|
||||
if (op->ch2 == -1)
|
||||
return (total);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user