mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-10-24 13:33:01 +03:00
Remove useless check in xmlParseAttributeListDecl
Since we already successfully parsed the attribute name and other items, it is guaranteed that we made progress in the input stream. Comparing the input pointer to a previous value also looks fragile to me. What if the input buffer was reallocated and the new "cur" pointer happens to be the same as the old one? There are a couple of similar checks which also take "consumed" into account. This seems to be safer but I'm not convinced that it couldn't lead to false alarms in rare situations.
This commit is contained in:
10
parser.c
10
parser.c
@@ -6107,7 +6107,6 @@ xmlParseAttributeListDecl(xmlParserCtxtPtr ctxt) {
|
|||||||
SKIP_BLANKS;
|
SKIP_BLANKS;
|
||||||
GROW;
|
GROW;
|
||||||
while ((RAW != '>') && (ctxt->instate != XML_PARSER_EOF)) {
|
while ((RAW != '>') && (ctxt->instate != XML_PARSER_EOF)) {
|
||||||
const xmlChar *check = CUR_PTR;
|
|
||||||
int type;
|
int type;
|
||||||
int def;
|
int def;
|
||||||
xmlChar *defaultValue = NULL;
|
xmlChar *defaultValue = NULL;
|
||||||
@@ -6167,15 +6166,6 @@ xmlParseAttributeListDecl(xmlParserCtxtPtr ctxt) {
|
|||||||
}
|
}
|
||||||
SKIP_BLANKS;
|
SKIP_BLANKS;
|
||||||
}
|
}
|
||||||
if (check == CUR_PTR) {
|
|
||||||
xmlFatalErr(ctxt, XML_ERR_INTERNAL_ERROR,
|
|
||||||
"in xmlParseAttributeListDecl\n");
|
|
||||||
if (defaultValue != NULL)
|
|
||||||
xmlFree(defaultValue);
|
|
||||||
if (tree != NULL)
|
|
||||||
xmlFreeEnumeration(tree);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if ((ctxt->sax != NULL) && (!ctxt->disableSAX) &&
|
if ((ctxt->sax != NULL) && (!ctxt->disableSAX) &&
|
||||||
(ctxt->sax->attributeDecl != NULL))
|
(ctxt->sax->attributeDecl != NULL))
|
||||||
ctxt->sax->attributeDecl(ctxt->userData, elemName, attrName,
|
ctxt->sax->attributeDecl(ctxt->userData, elemName, attrName,
|
||||||
|
|||||||
Reference in New Issue
Block a user