summaryrefslogtreecommitdiff
path: root/xpath.c
diff options
context:
space:
mode:
authorNick Wellnhofer <wellnhofer@aevum.de>2023-01-30 15:40:23 +0100
committerNick Wellnhofer <wellnhofer@aevum.de>2023-02-03 12:40:15 +0100
commit755344013e161ab7c982290c6c78903bd9bd300e (patch)
treeae1feda17e8b76c780a47502954042b828e9188a /xpath.c
parent0e4421e793e52e2025297f9252c4dc76b72674c7 (diff)
downloadlibxml2-755344013e161ab7c982290c6c78903bd9bd300e.tar.gz
malloc-fail: Record malloc failure in xmlXPathCompLiteral
Avoid OOB array access. Found with libFuzzer, see #344.
Diffstat (limited to 'xpath.c')
-rw-r--r--xpath.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/xpath.c b/xpath.c
index ceed3f21..5cacc2cb 100644
--- a/xpath.c
+++ b/xpath.c
@@ -10272,7 +10272,10 @@ xmlXPathCompLiteral(xmlXPathParserContextPtr ctxt) {
} else {
XP_ERROR(XPATH_START_LITERAL_ERROR);
}
- if (ret == NULL) return;
+ if (ret == NULL) {
+ xmlXPathPErrMemory(ctxt, NULL);
+ return;
+ }
lit = xmlXPathCacheNewString(ctxt->context, ret);
if (lit == NULL) {
ctxt->error = XPATH_MEMORY_ERROR;