mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-10-24 13:33:01 +03:00
Fix some buffer conversion issues
https://bugzilla.gnome.org/show_bug.cgi?id=690202 Buffer overflow errors originating from xmlBufGetInputBase in 2.9.0 The pointers from the context input were not properly reset after that call which can do reallocations.
This commit is contained in:
@@ -6054,6 +6054,8 @@ htmlParseChunk(htmlParserCtxtPtr ctxt, const char *chunk, int size,
|
||||
if ((in->encoder != NULL) && (in->buffer != NULL) &&
|
||||
(in->raw != NULL)) {
|
||||
int nbchars;
|
||||
size_t base = xmlBufGetInputBase(in->buffer, ctxt->input);
|
||||
size_t current = ctxt->input->cur - ctxt->input->base;
|
||||
|
||||
nbchars = xmlCharEncInput(in);
|
||||
if (nbchars < 0) {
|
||||
@@ -6061,6 +6063,7 @@ htmlParseChunk(htmlParserCtxtPtr ctxt, const char *chunk, int size,
|
||||
"encoder error\n", NULL, NULL);
|
||||
return(XML_ERR_INVALID_ENCODING);
|
||||
}
|
||||
xmlBufSetInputBaseCur(in->buffer, ctxt->input, base, current);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user