1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2024-12-25 23:21:26 +03:00

parser: Grow input buffer earlier when reading characters

Make more bytes available after invoking CUR_CHAR or NEXT.
This commit is contained in:
Nick Wellnhofer 2023-03-21 13:26:36 +01:00
parent 98840d40da
commit 7fbd454d9f
2 changed files with 3 additions and 3 deletions

View File

@ -411,7 +411,7 @@ htmlCurrentChar(xmlParserCtxtPtr ctxt, int *len) {
return(ctxt->token); return(ctxt->token);
} }
if ((ctxt->input->end - ctxt->input->cur < 4) && if ((ctxt->input->end - ctxt->input->cur < INPUT_CHUNK) &&
(xmlParserGrow(ctxt) < 0)) (xmlParserGrow(ctxt) < 0))
return(0); return(0);

View File

@ -527,7 +527,7 @@ xmlNextChar(xmlParserCtxtPtr ctxt)
return; return;
} }
if (ctxt->input->end - ctxt->input->cur < 4) { if (ctxt->input->end - ctxt->input->cur < INPUT_CHUNK) {
if (xmlParserGrow(ctxt) < 0) if (xmlParserGrow(ctxt) < 0)
return; return;
if (ctxt->input->cur >= ctxt->input->end) if (ctxt->input->cur >= ctxt->input->end)
@ -674,7 +674,7 @@ xmlCurrentChar(xmlParserCtxtPtr ctxt, int *len) {
if (ctxt->instate == XML_PARSER_EOF) if (ctxt->instate == XML_PARSER_EOF)
return(0); return(0);
if ((ctxt->input->end - ctxt->input->cur < 4) && if ((ctxt->input->end - ctxt->input->cur < INPUT_CHUNK) &&
(xmlParserGrow(ctxt) < 0)) (xmlParserGrow(ctxt) < 0))
return(0); return(0);