From 4ba8cc856bd2d11f3c500a27bca7b56d826a19b6 Mon Sep 17 00:00:00 2001 From: Nick Wellnhofer Date: Sat, 10 Jun 2017 02:33:58 +0200 Subject: [PATCH] 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. --- parser.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/parser.c b/parser.c index d07d3e6c..781aa0c5 100644 --- a/parser.c +++ b/parser.c @@ -6107,7 +6107,6 @@ xmlParseAttributeListDecl(xmlParserCtxtPtr ctxt) { SKIP_BLANKS; GROW; while ((RAW != '>') && (ctxt->instate != XML_PARSER_EOF)) { - const xmlChar *check = CUR_PTR; int type; int def; xmlChar *defaultValue = NULL; @@ -6167,15 +6166,6 @@ xmlParseAttributeListDecl(xmlParserCtxtPtr ctxt) { } 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) && (ctxt->sax->attributeDecl != NULL)) ctxt->sax->attributeDecl(ctxt->userData, elemName, attrName,