1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-10-24 13:33:01 +03:00

parser: Recover more input from encoding errors

Don't halt the parser in xmlParserGrow to allow more input to be
recovered in case of encoding errors.

Fixes #543.
This commit is contained in:
Nick Wellnhofer
2023-06-07 14:05:34 +02:00
parent db21cd5db9
commit 20f5c73457
2 changed files with 16 additions and 12 deletions

View File

@@ -411,9 +411,11 @@ htmlCurrentChar(xmlParserCtxtPtr ctxt, int *len) {
return(ctxt->token);
}
if ((ctxt->input->end - ctxt->input->cur < INPUT_CHUNK) &&
(xmlParserGrow(ctxt) < 0))
return(0);
if (ctxt->input->end - ctxt->input->cur < INPUT_CHUNK) {
xmlParserGrow(ctxt);
if (ctxt->instate == XML_PARSER_EOF)
return(0);
}
if (ctxt->charset != XML_CHAR_ENCODING_UTF8) {
xmlChar * guess;