mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2026-01-26 21:41:34 +03:00
parser: Make sure to stop parser before checking max errors
Short-lived regression from 7a41b18c.
This commit is contained in:
@@ -330,11 +330,31 @@ xmlCtxtVErr(xmlParserCtxt *ctxt, xmlNode *node, xmlErrorDomain domain,
|
||||
return;
|
||||
ctxt->nbWarnings += 1;
|
||||
} else {
|
||||
/* Report at least one fatal error. */
|
||||
if ((ctxt->nbErrors >= XML_MAX_ERRORS) &&
|
||||
((level < XML_ERR_FATAL) || (ctxt->wellFormed == 0)) &&
|
||||
(!xmlIsCatastrophicError(level, code)))
|
||||
return;
|
||||
/*
|
||||
* By long-standing design, the parser isn't completely
|
||||
* stopped on well-formedness errors. Only SAX callbacks
|
||||
* are disabled.
|
||||
*
|
||||
* In some situations, we really want to abort as fast
|
||||
* as possible.
|
||||
*/
|
||||
if (xmlIsCatastrophicError(level, code) ||
|
||||
code == XML_ERR_RESOURCE_LIMIT ||
|
||||
code == XML_ERR_ENTITY_LOOP) {
|
||||
ctxt->disableSAX = 2; /* really stop parser */
|
||||
} else {
|
||||
/* Report at least one fatal error. */
|
||||
if (ctxt->nbErrors >= XML_MAX_ERRORS &&
|
||||
(level < XML_ERR_FATAL || ctxt->wellFormed == 0))
|
||||
return;
|
||||
|
||||
if (level == XML_ERR_FATAL && ctxt->recovery == 0)
|
||||
ctxt->disableSAX = 1;
|
||||
}
|
||||
|
||||
if (level == XML_ERR_FATAL)
|
||||
ctxt->wellFormed = 0;
|
||||
ctxt->errNo = code;
|
||||
ctxt->nbErrors += 1;
|
||||
}
|
||||
|
||||
@@ -384,27 +404,6 @@ xmlCtxtVErr(xmlParserCtxt *ctxt, xmlNode *node, xmlErrorDomain domain,
|
||||
xmlCtxtErrMemory(ctxt);
|
||||
return;
|
||||
}
|
||||
|
||||
if (level >= XML_ERR_ERROR)
|
||||
ctxt->errNo = code;
|
||||
if (level == XML_ERR_FATAL) {
|
||||
ctxt->wellFormed = 0;
|
||||
|
||||
/*
|
||||
* By long-standing design, the parser isn't completely
|
||||
* stopped on well-formedness errors. Only SAX callbacks
|
||||
* are disabled.
|
||||
*
|
||||
* In some situations, we really want to abort as fast
|
||||
* as possible.
|
||||
*/
|
||||
if (xmlCtxtIsCatastrophicError(ctxt) ||
|
||||
code == XML_ERR_RESOURCE_LIMIT ||
|
||||
code == XML_ERR_ENTITY_LOOP)
|
||||
ctxt->disableSAX = 2; /* really stop parser */
|
||||
else if (ctxt->recovery == 0)
|
||||
ctxt->disableSAX = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user