1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-01-11 05:17:37 +03:00

parser: Fix "Truncated multi-byte sequence" error

Don't raise the error if decoding failed.
This commit is contained in:
Nick Wellnhofer 2024-06-06 23:50:03 +02:00
parent 02cbb2b64f
commit 0cde1b78d6

View File

@ -10584,6 +10584,7 @@ xmlParseDocument(xmlParserCtxtPtr ctxt) {
xmlFatalErr(ctxt, XML_ERR_DOCUMENT_END, NULL);
} else if ((ctxt->input->buf != NULL) &&
(ctxt->input->buf->encoder != NULL) &&
(ctxt->input->buf->error == 0) &&
(!xmlBufIsEmpty(ctxt->input->buf->raw))) {
xmlFatalErrMsg(ctxt, XML_ERR_INVALID_CHAR,
"Truncated multi-byte sequence at EOF\n");
@ -11589,6 +11590,7 @@ xmlParseChunk(xmlParserCtxtPtr ctxt, const char *chunk, int size,
}
} else if ((ctxt->input->buf != NULL) &&
(ctxt->input->buf->encoder != NULL) &&
(ctxt->input->buf->error == 0) &&
(!xmlBufIsEmpty(ctxt->input->buf->raw))) {
xmlFatalErrMsg(ctxt, XML_ERR_INVALID_CHAR,
"Truncated multi-byte sequence at EOF\n");