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 --- expat/lib/xmlparse.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/expat/lib/xmlparse.c b/expat/lib/xmlparse.c index 61549930..aacd6e7f 100644 --- a/expat/lib/xmlparse.c +++ b/expat/lib/xmlparse.c @@ -5813,6 +5813,14 @@ internalEntityProcessor(XML_Parser parser, const char *s, const char *end, 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 if (entity->is_param) { int tok;