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

parser: Decode all data in xmlCharEncInput

Even with flush set to true, xmlCharEncInput didn't guarantee to decode
all data. This complicated the push parser.

Remove the flush flag and always decode all available data.

Also fix ICU code where the flush flag has a different meaning. Always
set flush to false and retry even with empty input buffers.
This commit is contained in:
Nick Wellnhofer
2023-08-08 15:21:31 +02:00
parent 834b8123ef
commit 95e81a360c
6 changed files with 66 additions and 123 deletions

View File

@@ -6110,29 +6110,6 @@ htmlParseChunk(htmlParserCtxtPtr ctxt, const char *chunk, int size,
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext, "HPP: pushed %d\n", size);
#endif
#if 0
if ((terminate) || (ctxt->input->buf->buffer->use > 80))
htmlParseTryOrFinish(ctxt, terminate);
#endif
} else if (ctxt->instate != XML_PARSER_EOF) {
if ((ctxt->input != NULL) && ctxt->input->buf != NULL) {
xmlParserInputBufferPtr in = ctxt->input->buf;
if ((in->encoder != NULL) && (in->buffer != NULL) &&
(in->raw != NULL)) {
int nbchars;
size_t pos = ctxt->input->cur - ctxt->input->base;
nbchars = xmlCharEncInput(in, terminate);
xmlBufUpdateInput(in->buffer, ctxt->input, pos);
if (nbchars < 0) {
htmlParseErr(ctxt, in->error,
"encoder error\n", NULL, NULL);
xmlHaltParser(ctxt);
return(XML_ERR_INVALID_ENCODING);
}
}
}
}
htmlParseTryOrFinish(ctxt, terminate);
if (terminate) {