Don't update partial token heuristic on error

Suggested-by: Sebastian Pipping <sebastian@pipping.org>
This commit is contained in:
Snild Dolkow 2023-09-04 17:21:14 +02:00
parent 9cdf9b8d77
commit 1b9d398517

View file

@ -997,11 +997,13 @@ callProcessor(XML_Parser parser, const char *start, const char *end,
}
}
const enum XML_Error ret = parser->m_processor(parser, start, end, endPtr);
// if we consumed nothing, remember what we had on this parse attempt.
if (*endPtr == start) {
parser->m_partialTokenBytesBefore = have_now;
} else {
parser->m_partialTokenBytesBefore = 0;
if (ret == XML_ERROR_NONE) {
// if we consumed nothing, remember what we had on this parse attempt.
if (*endPtr == start) {
parser->m_partialTokenBytesBefore = have_now;
} else {
parser->m_partialTokenBytesBefore = 0;
}
}
return ret;
}