From 6fa8957d335d5463428bba197468cd07834e3952 Mon Sep 17 00:00:00 2001 From: Sebastian Pipping Date: Sun, 25 Sep 2022 17:55:41 +0200 Subject: [PATCH] lib: Fix suspend with inside nested entites in internalEntityProcessor Reference: https://github.com/libexpat/libexpat/commit/6fa8957d335d5463428bba197468cd07834e3952 Conflict: adapt internalEntityProcessor --- lib/xmlparse.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/xmlparse.c b/lib/xmlparse.c index bd2990d..bf42f8a 100644 --- a/lib/xmlparse.c +++ b/lib/xmlparse.c @@ -5903,6 +5903,14 @@ internalEntityProcessor(XML_Parser parser, const char *s, const char *end, /* put openEntity back in list of free instances */ openEntity->next = parser->m_freeInternalEntities; parser->m_freeInternalEntities = openEntity; + + // If there are more open entities we want to stop right here and have the + // upcoming call to XML_ResumeParser continue with entity content, or it would + // be ignored altogether. + if (parser->m_openInternalEntities != NULL + && parser->m_parsingStatus.parsing == XML_SUSPENDED) { + return XML_ERROR_NONE; + } } #ifdef XML_DTD -- 2.33.0