mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-10-26 00:37:43 +03:00
html: Fix UAF in htmlCurrentChar
Short-lived regression found by OSS-Fuzz.
This commit is contained in:
@@ -445,7 +445,6 @@ htmlCurrentChar(xmlParserCtxtPtr ctxt, int *len) {
|
|||||||
xmlSwitchEncoding(ctxt, XML_CHAR_ENCODING_8859_1);
|
xmlSwitchEncoding(ctxt, XML_CHAR_ENCODING_8859_1);
|
||||||
} else {
|
} else {
|
||||||
handler = xmlFindCharEncodingHandler((const char *) guess);
|
handler = xmlFindCharEncodingHandler((const char *) guess);
|
||||||
xmlFree(guess);
|
|
||||||
if (handler != NULL) {
|
if (handler != NULL) {
|
||||||
/*
|
/*
|
||||||
* Don't use UTF-8 encoder which isn't required and
|
* Don't use UTF-8 encoder which isn't required and
|
||||||
@@ -457,6 +456,7 @@ htmlCurrentChar(xmlParserCtxtPtr ctxt, int *len) {
|
|||||||
htmlParseErr(ctxt, XML_ERR_INVALID_ENCODING,
|
htmlParseErr(ctxt, XML_ERR_INVALID_ENCODING,
|
||||||
"Unsupported encoding %s", guess, NULL);
|
"Unsupported encoding %s", guess, NULL);
|
||||||
}
|
}
|
||||||
|
xmlFree(guess);
|
||||||
}
|
}
|
||||||
ctxt->input->flags |= XML_INPUT_HAS_ENCODING;
|
ctxt->input->flags |= XML_INPUT_HAS_ENCODING;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user