mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-10-27 12:15:34 +03:00
a bit of cleanup and added checks based on the regression tests of the
* include/libxml/xmlerror.h parser.c: a bit of cleanup and added checks based on the regression tests of the xmlconf suite Daniel svn path=/trunk/; revision=3782
This commit is contained in:
@@ -1,3 +1,8 @@
|
|||||||
|
Wed Aug 27 21:55:34 CEST 2008 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
|
* include/libxml/xmlerror.h parser.c: a bit of cleanup and
|
||||||
|
added checks based on the regression tests of the xmlconf suite
|
||||||
|
|
||||||
Wed Aug 27 19:22:35 CEST 2008 Daniel Veillard <daniel@veillard.com>
|
Wed Aug 27 19:22:35 CEST 2008 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
* uri.c: bug in parsing RFC 3986 uris with port numbers
|
* uri.c: bug in parsing RFC 3986 uris with port numbers
|
||||||
|
|||||||
@@ -252,6 +252,7 @@ typedef enum {
|
|||||||
XML_DTD_STANDALONE_DEFAULTED, /* 538 */
|
XML_DTD_STANDALONE_DEFAULTED, /* 538 */
|
||||||
XML_DTD_XMLID_VALUE, /* 539 */
|
XML_DTD_XMLID_VALUE, /* 539 */
|
||||||
XML_DTD_XMLID_TYPE, /* 540 */
|
XML_DTD_XMLID_TYPE, /* 540 */
|
||||||
|
XML_DTD_DUP_TOKEN, /* 541 */
|
||||||
XML_HTML_STRUCURE_ERROR = 800,
|
XML_HTML_STRUCURE_ERROR = 800,
|
||||||
XML_HTML_UNKNOWN_TAG, /* 801 */
|
XML_HTML_UNKNOWN_TAG, /* 801 */
|
||||||
XML_RNGP_ANYNAME_ATTR_ANCESTOR = 1000,
|
XML_RNGP_ANYNAME_ATTR_ANCESTOR = 1000,
|
||||||
|
|||||||
81
parser.c
81
parser.c
@@ -5209,7 +5209,7 @@ xmlParseDefaultDecl(xmlParserCtxtPtr ctxt, xmlChar **value) {
|
|||||||
xmlEnumerationPtr
|
xmlEnumerationPtr
|
||||||
xmlParseNotationType(xmlParserCtxtPtr ctxt) {
|
xmlParseNotationType(xmlParserCtxtPtr ctxt) {
|
||||||
const xmlChar *name;
|
const xmlChar *name;
|
||||||
xmlEnumerationPtr ret = NULL, last = NULL, cur;
|
xmlEnumerationPtr ret = NULL, last = NULL, cur, tmp;
|
||||||
|
|
||||||
if (RAW != '(') {
|
if (RAW != '(') {
|
||||||
xmlFatalErr(ctxt, XML_ERR_NOTATION_NOT_STARTED, NULL);
|
xmlFatalErr(ctxt, XML_ERR_NOTATION_NOT_STARTED, NULL);
|
||||||
@@ -5225,12 +5225,26 @@ xmlParseNotationType(xmlParserCtxtPtr ctxt) {
|
|||||||
"Name expected in NOTATION declaration\n");
|
"Name expected in NOTATION declaration\n");
|
||||||
return(ret);
|
return(ret);
|
||||||
}
|
}
|
||||||
cur = xmlCreateEnumeration(name);
|
tmp = ret;
|
||||||
if (cur == NULL) return(ret);
|
while (tmp != NULL) {
|
||||||
if (last == NULL) ret = last = cur;
|
if (xmlStrEqual(name, tmp->name)) {
|
||||||
else {
|
xmlValidityError(ctxt, XML_DTD_DUP_TOKEN,
|
||||||
last->next = cur;
|
"standalone: attribute notation value token %s duplicated\n",
|
||||||
last = cur;
|
name, NULL);
|
||||||
|
if (!xmlDictOwns(ctxt->dict, name))
|
||||||
|
xmlFree((xmlChar *) name);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
tmp = tmp->next;
|
||||||
|
}
|
||||||
|
if (tmp == NULL) {
|
||||||
|
cur = xmlCreateEnumeration(name);
|
||||||
|
if (cur == NULL) return(ret);
|
||||||
|
if (last == NULL) ret = last = cur;
|
||||||
|
else {
|
||||||
|
last->next = cur;
|
||||||
|
last = cur;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
SKIP_BLANKS;
|
SKIP_BLANKS;
|
||||||
} while (RAW == '|');
|
} while (RAW == '|');
|
||||||
@@ -5262,7 +5276,7 @@ xmlParseNotationType(xmlParserCtxtPtr ctxt) {
|
|||||||
xmlEnumerationPtr
|
xmlEnumerationPtr
|
||||||
xmlParseEnumerationType(xmlParserCtxtPtr ctxt) {
|
xmlParseEnumerationType(xmlParserCtxtPtr ctxt) {
|
||||||
xmlChar *name;
|
xmlChar *name;
|
||||||
xmlEnumerationPtr ret = NULL, last = NULL, cur;
|
xmlEnumerationPtr ret = NULL, last = NULL, cur, tmp;
|
||||||
|
|
||||||
if (RAW != '(') {
|
if (RAW != '(') {
|
||||||
xmlFatalErr(ctxt, XML_ERR_ATTLIST_NOT_STARTED, NULL);
|
xmlFatalErr(ctxt, XML_ERR_ATTLIST_NOT_STARTED, NULL);
|
||||||
@@ -5277,13 +5291,28 @@ xmlParseEnumerationType(xmlParserCtxtPtr ctxt) {
|
|||||||
xmlFatalErr(ctxt, XML_ERR_NMTOKEN_REQUIRED, NULL);
|
xmlFatalErr(ctxt, XML_ERR_NMTOKEN_REQUIRED, NULL);
|
||||||
return(ret);
|
return(ret);
|
||||||
}
|
}
|
||||||
cur = xmlCreateEnumeration(name);
|
tmp = ret;
|
||||||
xmlFree(name);
|
while (tmp != NULL) {
|
||||||
if (cur == NULL) return(ret);
|
if (xmlStrEqual(name, tmp->name)) {
|
||||||
if (last == NULL) ret = last = cur;
|
xmlValidityError(ctxt, XML_DTD_DUP_TOKEN,
|
||||||
else {
|
"standalone: attribute enumeration value token %s duplicated\n",
|
||||||
last->next = cur;
|
name, NULL);
|
||||||
last = cur;
|
if (!xmlDictOwns(ctxt->dict, name))
|
||||||
|
xmlFree(name);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
tmp = tmp->next;
|
||||||
|
}
|
||||||
|
if (tmp == NULL) {
|
||||||
|
cur = xmlCreateEnumeration(name);
|
||||||
|
if (!xmlDictOwns(ctxt->dict, name))
|
||||||
|
xmlFree(name);
|
||||||
|
if (cur == NULL) return(ret);
|
||||||
|
if (last == NULL) ret = last = cur;
|
||||||
|
else {
|
||||||
|
last->next = cur;
|
||||||
|
last = cur;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
SKIP_BLANKS;
|
SKIP_BLANKS;
|
||||||
} while (RAW == '|');
|
} while (RAW == '|');
|
||||||
@@ -5530,8 +5559,9 @@ xmlParseAttributeListDecl(xmlParserCtxtPtr ctxt) {
|
|||||||
}
|
}
|
||||||
if (RAW == '>') {
|
if (RAW == '>') {
|
||||||
if (input != ctxt->input) {
|
if (input != ctxt->input) {
|
||||||
xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_BOUNDARY,
|
xmlValidityError(ctxt, XML_ERR_ENTITY_BOUNDARY,
|
||||||
"Attribute list declaration doesn't start and stop in the same entity\n");
|
"Attribute list declaration doesn't start and stop in the same entity\n",
|
||||||
|
NULL, NULL);
|
||||||
}
|
}
|
||||||
NEXT;
|
NEXT;
|
||||||
}
|
}
|
||||||
@@ -6103,6 +6133,8 @@ xmlParseElementDecl(xmlParserCtxtPtr ctxt) {
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
xmlParseConditionalSections(xmlParserCtxtPtr ctxt) {
|
xmlParseConditionalSections(xmlParserCtxtPtr ctxt) {
|
||||||
|
int id = ctxt->input->id;
|
||||||
|
|
||||||
SKIP(3);
|
SKIP(3);
|
||||||
SKIP_BLANKS;
|
SKIP_BLANKS;
|
||||||
if (CMP7(CUR_PTR, 'I', 'N', 'C', 'L', 'U', 'D', 'E')) {
|
if (CMP7(CUR_PTR, 'I', 'N', 'C', 'L', 'U', 'D', 'E')) {
|
||||||
@@ -6111,6 +6143,11 @@ xmlParseConditionalSections(xmlParserCtxtPtr ctxt) {
|
|||||||
if (RAW != '[') {
|
if (RAW != '[') {
|
||||||
xmlFatalErr(ctxt, XML_ERR_CONDSEC_INVALID, NULL);
|
xmlFatalErr(ctxt, XML_ERR_CONDSEC_INVALID, NULL);
|
||||||
} else {
|
} else {
|
||||||
|
if (ctxt->input->id != id) {
|
||||||
|
xmlValidityError(ctxt, XML_ERR_ENTITY_BOUNDARY,
|
||||||
|
"All markup of the conditional section is not in the same entity\n",
|
||||||
|
NULL, NULL);
|
||||||
|
}
|
||||||
NEXT;
|
NEXT;
|
||||||
}
|
}
|
||||||
if (xmlParserDebugEntities) {
|
if (xmlParserDebugEntities) {
|
||||||
@@ -6166,6 +6203,11 @@ xmlParseConditionalSections(xmlParserCtxtPtr ctxt) {
|
|||||||
if (RAW != '[') {
|
if (RAW != '[') {
|
||||||
xmlFatalErr(ctxt, XML_ERR_CONDSEC_INVALID, NULL);
|
xmlFatalErr(ctxt, XML_ERR_CONDSEC_INVALID, NULL);
|
||||||
} else {
|
} else {
|
||||||
|
if (ctxt->input->id != id) {
|
||||||
|
xmlValidityError(ctxt, XML_ERR_ENTITY_BOUNDARY,
|
||||||
|
"All markup of the conditional section is not in the same entity\n",
|
||||||
|
NULL, NULL);
|
||||||
|
}
|
||||||
NEXT;
|
NEXT;
|
||||||
}
|
}
|
||||||
if (xmlParserDebugEntities) {
|
if (xmlParserDebugEntities) {
|
||||||
@@ -6222,6 +6264,11 @@ xmlParseConditionalSections(xmlParserCtxtPtr ctxt) {
|
|||||||
if (RAW == 0) {
|
if (RAW == 0) {
|
||||||
xmlFatalErr(ctxt, XML_ERR_CONDSEC_NOT_FINISHED, NULL);
|
xmlFatalErr(ctxt, XML_ERR_CONDSEC_NOT_FINISHED, NULL);
|
||||||
} else {
|
} else {
|
||||||
|
if (ctxt->input->id != id) {
|
||||||
|
xmlValidityError(ctxt, XML_ERR_ENTITY_BOUNDARY,
|
||||||
|
"All markup of the conditional section is not in the same entity\n",
|
||||||
|
NULL, NULL);
|
||||||
|
}
|
||||||
SKIP(3);
|
SKIP(3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user