From 2b9fee2b0baf675b38b5e11756e9339d14c27a3a Mon Sep 17 00:00:00 2001 From: Nick Wellnhofer Date: Wed, 23 Oct 2019 11:40:34 +0200 Subject: [PATCH 2/3] Fix for conditional sections at end of document Parsing conditional sections would fail if the final ']]>' was at the end of the document. Short-lived regression caused by commit c51e38cb. backport from https://gitlab.gnome.org/GNOME/libxml2/commit/c1035664f989c2ac7ca31407bc6f0b48396db42c --- parser.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/parser.c b/parser.c index bfa6585..f188c9d 100644 --- a/parser.c +++ b/parser.c @@ -6723,6 +6723,9 @@ xmlParseConditionalSections(xmlParserCtxtPtr ctxt) { ctxt->disableSAX = state; ctxt->instate = instate; + if (RAW == 0) { + xmlFatalErr(ctxt, XML_ERR_CONDSEC_NOT_FINISHED, NULL); + } if (ctxt->input->id != id) { xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_BOUNDARY, "All markup of the conditional section is" @@ -6763,10 +6766,6 @@ xmlParseConditionalSections(xmlParserCtxtPtr ctxt) { GROW; } - if (RAW == 0) { - xmlFatalErr(ctxt, XML_ERR_CONDSEC_NOT_FINISHED, NULL); - } - error: xmlFree(inputIds); } -- 2.18.1