mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-03-31 06:50:06 +03:00
malloc-fail: Fix infinite loop in xmlParseTextDecl
Memory errors can set `instate` to `XML_PARSER_EOF` which results in `NEXT` making no progress. Found with libFuzzer, see #344.
This commit is contained in:
parent
bd9de3a31f
commit
d1b8785693
2
parser.c
2
parser.c
@ -7046,6 +7046,8 @@ xmlParseTextDecl(xmlParserCtxtPtr ctxt) {
|
||||
* We must have the encoding declaration
|
||||
*/
|
||||
encoding = xmlParseEncodingDecl(ctxt);
|
||||
if (ctxt->instate == XML_PARSER_EOF)
|
||||
return;
|
||||
if (ctxt->errNo == XML_ERR_UNSUPPORTED_ENCODING) {
|
||||
/*
|
||||
* The XML REC instructs us to stop parsing right here
|
||||
|
Loading…
x
Reference in New Issue
Block a user