1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-01-12 09:17:37 +03:00

fixed problem with free on dupl attribute in dtd (bug309637). added

* parser.c: fixed problem with free on dupl attribute in
  dtd (bug309637).
* test/errors/attr3.xml, result/errors/attr3.*: added
  regression test for this
This commit is contained in:
William M. Brack 2005-07-06 22:48:41 +00:00
parent ca15a54652
commit f810de0436
6 changed files with 31 additions and 1 deletions

View File

@ -1,3 +1,10 @@
Wed Jul 6 15:45:48 PDT 2005 William Brack <wbrack@mmm.com.hk>
* parser.c: fixed problem with free on dupl attribute in
dtd (bug309637).
* test/errors/attr3.xml, result/errors/attr3.*: added
regression test for this
Wed Jul 6 13:11:35 PDT 2005 William Brack <wbrack@mmm.com.hk>
* win32/Makefile.msvc: try again to fix file format for Windows

6
result/errors/attr3.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0"?>
<!DOCTYPE doc [
<!ELEMENT doc (#PCDATA)>
<!ATTLIST doc a1 CDATA "v1">
]>
<doc/>

View File

@ -0,0 +1,3 @@
./test/errors/attr3.xml:4: validity warning : Attribute a1 of element doc: already defined
<!ATTLIST doc a1 CDATA "z1">
^

View File

@ -0,0 +1,3 @@
./test/errors/attr3.xml:4: validity warning : Attribute a1 of element doc: already defined
<!ATTLIST doc a1 CDATA "z1">
^

6
test/errors/attr3.xml Normal file
View File

@ -0,0 +1,6 @@
<!DOCTYPE doc [
<!ELEMENT doc (#PCDATA)>
<!ATTLIST doc a1 CDATA "v1">
<!ATTLIST doc a1 CDATA "z1">
]>
<doc></doc>

View File

@ -2063,6 +2063,12 @@ xmlAddAttributeDecl(xmlValidCtxtPtr ctxt,
* fill the structure.
*/
ret->atype = type;
/*
* doc must be set before possible error causes call
* to xmlFreeAttribute (because it's used to check on
* dict use)
*/
ret->doc = dtd->doc;
if (dict) {
ret->name = xmlDictLookup(dict, name, -1);
ret->prefix = xmlDictLookup(dict, ns, -1);
@ -2150,7 +2156,6 @@ xmlAddAttributeDecl(xmlValidCtxtPtr ctxt,
* Link it to the DTD
*/
ret->parent = dtd;
ret->doc = dtd->doc;
if (dtd->last == NULL) {
dtd->children = dtd->last = (xmlNodePtr) ret;
} else {