diff options
author | Nick Wellnhofer <wellnhofer@aevum.de> | 2023-01-30 15:40:23 +0100 |
---|---|---|
committer | Nick Wellnhofer <wellnhofer@aevum.de> | 2023-02-03 12:40:15 +0100 |
commit | 755344013e161ab7c982290c6c78903bd9bd300e (patch) | |
tree | ae1feda17e8b76c780a47502954042b828e9188a /xpath.c | |
parent | 0e4421e793e52e2025297f9252c4dc76b72674c7 (diff) | |
download | libxml2-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.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -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; |