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

parser: Fix entity check in attributes

Don't mark entities as "checked" when processing default attribute
values. These entities could reference other entities which weren't
defined yet, so the check isn't reliable.

This backports commit d320a683 to the 2.10 branch. It turned out that
the issue wasn't a short-lived regression after all.
This commit is contained in:
Nick Wellnhofer 2023-04-26 18:46:47 +02:00
parent 223cb03a5d
commit ee0520e097

View File

@ -4057,12 +4057,20 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) {
XML_SUBSTITUTE_REF, 0, 0, 0); XML_SUBSTITUTE_REF, 0, 0, 0);
--ctxt->depth; --ctxt->depth;
diff = ctxt->nbentities - oldnbent + 1; /*
if (diff > INT_MAX / 2) * If we're parsing DTD content, the entity
diff = INT_MAX / 2; * might reference other entities which
ent->checked = diff * 2; * weren't defined yet, so the check isn't
* reliable.
*/
if (ctxt->inSubset == 0) {
diff = ctxt->nbentities - oldnbent + 1;
if (diff > INT_MAX / 2)
diff = INT_MAX / 2;
ent->checked = diff * 2;
}
if (rep != NULL) { if (rep != NULL) {
if (xmlStrchr(rep, '<')) if ((ctxt->inSubset == 0) && (xmlStrchr(rep, '<')))
ent->checked |= 1; ent->checked |= 1;
xmlFree(rep); xmlFree(rep);
rep = NULL; rep = NULL;