mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-03-19 14:50:07 +03:00
Check XPath stack after calling functions
Check that there's exactly one return value on the stack after calling XPath functions. Otherwise, functions that corrupt the stack without signaling an error could lead to memory errors. Found with libFuzzer and UBSan.
This commit is contained in:
parent
c494a0ba67
commit
236dd6ab2e
3
xpath.c
3
xpath.c
@ -13431,6 +13431,9 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
|
||||
func(ctxt, op->value);
|
||||
ctxt->context->function = oldFunc;
|
||||
ctxt->context->functionURI = oldFuncURI;
|
||||
if ((ctxt->error == XPATH_EXPRESSION_OK) &&
|
||||
(ctxt->valueNr != ctxt->valueFrame + 1))
|
||||
XP_ERROR0(XPATH_STACK_ERROR);
|
||||
xmlXPathPopFrame(ctxt, frame);
|
||||
return (total);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user