1From 53d1cc98cf08c789087a92fd57da70811abe7d60 Mon Sep 17 00:00:00 2001 2From: Nick Wellnhofer <wellnhofer@aevum.de> 3Date: Thu, 16 Feb 2023 15:09:32 +0100 4Subject: [PATCH] malloc-fail: Fix error code in htmlParseChunk 5 6Found with libFuzzer, see #344. 7 8Reference:https://github.com/GNOME/libxml2/commit/53d1cc98cf08c789087a92fd57da70811abe7d60 9Conflict:NA 10--- 11 HTMLparser.c | 5 ++--- 12 1 file changed, 2 insertions(+), 3 deletions(-) 13 14diff --git a/HTMLparser.c b/HTMLparser.c 15index 457b2a3..72ede56 100644 16--- a/HTMLparser.c 17+++ b/HTMLparser.c 18@@ -6276,9 +6276,8 @@ htmlParseChunk(htmlParserCtxtPtr ctxt, const char *chunk, int size, 19 res = xmlParserInputBufferPush(ctxt->input->buf, size, chunk); 20 xmlBufSetInputBaseCur(ctxt->input->buf->buffer, ctxt->input, base, cur); 21 if (res < 0) { 22- ctxt->errNo = XML_PARSER_EOF; 23- ctxt->disableSAX = 1; 24- return (XML_PARSER_EOF); 25+ htmlErrMemory(ctxt, NULL); 26+ return (ctxt->errNo); 27 } 28 #ifdef DEBUG_PUSH 29 xmlGenericError(xmlGenericErrorContext, "HPP: pushed %d\n", size); 30-- 312.27.0 32 33