1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2024-10-26 12:25:09 +03:00

Fix use-after-free in xmlParseContentInternal()

* parser.c:
(xmlParseCharData):
- Check if the parser has stopped before advancing
  `ctxt->input->cur`.  This only occurs if a custom SAX error
  handler calls xmlStopParser() on fatal errors.

Fixes #518.
This commit is contained in:
David Kilzer 2023-04-15 18:04:03 -07:00
parent a19fa11e1d
commit 86105c0493

View File

@ -4447,7 +4447,8 @@ get_more:
if (*in == ']') {
if ((in[1] == ']') && (in[2] == '>')) {
xmlFatalErr(ctxt, XML_ERR_MISPLACED_CDATA_END, NULL);
ctxt->input->cur = in + 1;
if (ctxt->instate != XML_PARSER_EOF)
ctxt->input->cur = in + 1;
return;
}
in++;