From 1c106edf2bc34976b040047cef69d35e55f4c206 Mon Sep 17 00:00:00 2001 From: Nick Wellnhofer Date: Wed, 13 Dec 2023 23:56:19 +0100 Subject: [PATCH] parser: Allow recovery in xmlParseInNodeContext Should fix #645. --- parser.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/parser.c b/parser.c index 2b32097b..dda19204 100644 --- a/parser.c +++ b/parser.c @@ -13135,13 +13135,11 @@ xmlParseInNodeContext(xmlNodePtr node, const char *data, int datalen, ctxt->wellFormed = 0; } - if (!ctxt->wellFormed) { - if (ctxt->errNo == 0) - ret = XML_ERR_INTERNAL_ERROR; - else - ret = (xmlParserErrors)ctxt->errNo; - } else { + if ((ctxt->wellFormed) || + ((ctxt->recovery) && (ctxt->errNo != XML_ERR_NO_MEMORY))) { ret = XML_ERR_OK; + } else { + ret = (xmlParserErrors) ctxt->errNo; } /*