mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-03-27 18:50:07 +03:00
Fix cleanup of attributes in XML reader
xml:id creates ID attributes even in documents without a DTD, so the check in xmlTextReaderFreeProp must be changed to avoid use after free. Found by OSS-Fuzz.
This commit is contained in:
parent
f0fd1b67fc
commit
b215c270fa
@ -359,12 +359,12 @@ xmlTextReaderFreeProp(xmlTextReaderPtr reader, xmlAttrPtr cur) {
|
||||
xmlDeregisterNodeDefaultValue((xmlNodePtr) cur);
|
||||
|
||||
/* Check for ID removal -> leading to invalid references ! */
|
||||
if ((cur->parent != NULL) && (cur->parent->doc != NULL) &&
|
||||
((cur->parent->doc->intSubset != NULL) ||
|
||||
(cur->parent->doc->extSubset != NULL))) {
|
||||
if ((cur->parent != NULL) && (cur->parent->doc != NULL)) {
|
||||
if (xmlIsID(cur->parent->doc, cur->parent, cur))
|
||||
xmlTextReaderRemoveID(cur->parent->doc, cur);
|
||||
if (xmlIsRef(cur->parent->doc, cur->parent, cur))
|
||||
if (((cur->parent->doc->intSubset != NULL) ||
|
||||
(cur->parent->doc->extSubset != NULL)) &&
|
||||
(xmlIsRef(cur->parent->doc, cur->parent, cur)))
|
||||
xmlTextReaderRemoveRef(cur->parent->doc, cur);
|
||||
}
|
||||
if (cur->children != NULL)
|
||||
|
Loading…
x
Reference in New Issue
Block a user