1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-01-29 21:46:59 +03:00

Make sure to grow input buffer in xmlParseMisc

Otherwise, large amount of whitespace could lead to documents not
being parsed correctly.

Fixes #299.
This commit is contained in:
Nick Wellnhofer 2022-02-07 15:26:33 +01:00
parent 9b8ef34dc9
commit 9653565765

View File

@ -10659,16 +10659,16 @@ xmlParseXMLDecl(xmlParserCtxtPtr ctxt) {
void
xmlParseMisc(xmlParserCtxtPtr ctxt) {
while ((ctxt->instate != XML_PARSER_EOF) &&
(((RAW == '<') && (NXT(1) == '?')) ||
(CMP4(CUR_PTR, '<', '!', '-', '-')) ||
IS_BLANK_CH(CUR))) {
while (ctxt->instate != XML_PARSER_EOF) {
SKIP_BLANKS;
GROW;
if ((RAW == '<') && (NXT(1) == '?')) {
xmlParsePI(ctxt);
} else if (IS_BLANK_CH(CUR)) {
NEXT;
} else
} else if (CMP4(CUR_PTR, '<', '!', '-', '-')) {
xmlParseComment(ctxt);
} else {
break;
}
}
}
@ -10774,7 +10774,6 @@ xmlParseDocument(xmlParserCtxtPtr ctxt) {
/*
* The Misc part of the Prolog
*/
GROW;
xmlParseMisc(ctxt);
/*