fix a memeory leak in internal subset parsing with a fix from Ashwin add

* parser.c: fix a memeory leak in internal subset parsing with
  a fix from Ashwin
* test/errors/content1.xml result/errors/content1.xml*:
  add test to regressions
Daniel

svn path=/trunk/; revision=3680
This commit is contained in:
Daniel Veillard 2008-01-24 14:48:54 +00:00
parent 72c1dfd9c6
commit c707d0b765
9 changed files with 54 additions and 7 deletions

View File

@ -1,3 +1,10 @@
Thu Jan 24 15:37:04 CET 2008 Daniel Veillard <daniel@veillard.com>
* parser.c: fix a memeory leak in internal subset parsing with
a fix from Ashwin
* test/errors/content1.xml result/errors/content1.xml*:
add test to regressions
Fri Jan 11 09:00:09 CET 2008 Daniel Veillard <daniel@veillard.com>
* configure.in doc/*: preparing release of 2.6.31

View File

@ -5,7 +5,7 @@ AC_CANONICAL_HOST
LIBXML_MAJOR_VERSION=2
LIBXML_MINOR_VERSION=6
LIBXML_MICRO_VERSION=30
LIBXML_MICRO_VERSION=31
LIBXML_MICRO_VERSION_SUFFIX=
LIBXML_VERSION=$LIBXML_MAJOR_VERSION.$LIBXML_MINOR_VERSION.$LIBXML_MICRO_VERSION$LIBXML_MICRO_VERSION_SUFFIX
LIBXML_VERSION_INFO=`expr $LIBXML_MAJOR_VERSION + $LIBXML_MINOR_VERSION`:$LIBXML_MICRO_VERSION:$LIBXML_MINOR_VERSION

View File

@ -101,6 +101,7 @@ int <a href="#xmlIsRef">xmlIsRef</a> (<a href="libxml2-tree.html#xmlDocPtr">xm
<a href="libxml2-tree.html#xmlElementContentPtr">xmlElementContentPtr</a> <a href="#xmlCopyDocElementContent">xmlCopyDocElementContent</a> (<a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a> doc, <br/> <a href="libxml2-tree.html#xmlElementContentPtr">xmlElementContentPtr</a> cur);
<a href="libxml2-tree.html#xmlIDPtr">xmlIDPtr</a> <a href="#xmlAddID">xmlAddID</a> (<a href="libxml2-valid.html#xmlValidCtxtPtr">xmlValidCtxtPtr</a> ctxt, <br/> <a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a> doc, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * value, <br/> <a href="libxml2-tree.html#xmlAttrPtr">xmlAttrPtr</a> attr);
void <a href="#xmlFreeRefTable">xmlFreeRefTable</a> (<a href="libxml2-valid.html#xmlRefTablePtr">xmlRefTablePtr</a> table);
int <a href="#xmlValidateNamesValue">xmlValidateNamesValue</a> (const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * value);
int <a href="#xmlRemoveID">xmlRemoveID</a> (<a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a> doc, <br/> <a href="libxml2-tree.html#xmlAttrPtr">xmlAttrPtr</a> attr);
void <a href="#xmlFreeElementTable">xmlFreeElementTable</a> (<a href="libxml2-valid.html#xmlElementTablePtr">xmlElementTablePtr</a> table);
void <a href="#xmlFreeIDTable">xmlFreeIDTable</a> (<a href="libxml2-valid.html#xmlIDTablePtr">xmlIDTablePtr</a> table);
@ -112,7 +113,6 @@ int <a href="#xmlRemoveRef">xmlRemoveRef</a> (<a href="libxml2-tree.html#xmlDo
typedef void <a href="#xmlValidityWarningFunc">xmlValidityWarningFunc</a> (void * ctx, <br/> const char * msg, <br/> ... ...);
int <a href="#xmlValidatePopElement">xmlValidatePopElement</a> (<a href="libxml2-valid.html#xmlValidCtxtPtr">xmlValidCtxtPtr</a> ctxt, <br/> <a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a> doc, <br/> <a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> elem, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * qname);
void <a href="#xmlFreeEnumeration">xmlFreeEnumeration</a> (<a href="libxml2-tree.html#xmlEnumerationPtr">xmlEnumerationPtr</a> cur);
int <a href="#xmlValidateNamesValue">xmlValidateNamesValue</a> (const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * value);
<a href="libxml2-tree.html#xmlEnumerationPtr">xmlEnumerationPtr</a> <a href="#xmlCopyEnumeration">xmlCopyEnumeration</a> (<a href="libxml2-tree.html#xmlEnumerationPtr">xmlEnumerationPtr</a> cur);
<a href="libxml2-tree.html#xmlAttributePtr">xmlAttributePtr</a> <a href="#xmlGetDtdAttrDesc">xmlGetDtdAttrDesc</a> (<a href="libxml2-tree.html#xmlDtdPtr">xmlDtdPtr</a> dtd, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * elem, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * name);
int <a href="#xmlValidateDtd">xmlValidateDtd</a> (<a href="libxml2-valid.html#xmlValidCtxtPtr">xmlValidCtxtPtr</a> ctxt, <br/> <a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a> doc, <br/> <a href="libxml2-tree.html#xmlDtdPtr">xmlDtdPtr</a> dtd);

View File

@ -1211,13 +1211,13 @@
<exports symbol='XML_SCHEMA_TYPE_SIMPLE' type='enum'/>
<exports symbol='XML_SCHEMAS_NCNAME' type='enum'/>
<exports symbol='XML_SCHEMAS_LONG' type='enum'/>
<exports symbol='XML_SCHEMA_FACET_FRACTIONDIGITS' type='enum'/>
<exports symbol='XML_SCHEMA_TYPE_ANY_ATTRIBUTE' type='enum'/>
<exports symbol='XML_SCHEMAS_BOOLEAN' type='enum'/>
<exports symbol='XML_SCHEMAS_ENTITY' type='enum'/>
<exports symbol='XML_SCHEMA_TYPE_GROUP' type='enum'/>
<exports symbol='XML_SCHEMAS_GYEARMONTH' type='enum'/>
<exports symbol='XML_SCHEMAS_BASE64BINARY' type='enum'/>
<exports symbol='XML_SCHEMA_TYPE_ANY_ATTRIBUTE' type='enum'/>
<exports symbol='XML_SCHEMA_FACET_FRACTIONDIGITS' type='enum'/>
<exports symbol='XML_SCHEMA_FACET_WHITESPACE' type='enum'/>
<exports symbol='XML_SCHEMAS_IDREF' type='enum'/>
<exports symbol='XML_SCHEMA_TYPE_ATTRIBUTE' type='enum'/>
@ -1744,6 +1744,7 @@
<exports symbol='xmlCopyDocElementContent' type='function'/>
<exports symbol='xmlAddID' type='function'/>
<exports symbol='xmlFreeRefTable' type='function'/>
<exports symbol='xmlValidateNamesValue' type='function'/>
<exports symbol='xmlRemoveID' type='function'/>
<exports symbol='xmlFreeElementTable' type='function'/>
<exports symbol='xmlFreeIDTable' type='function'/>
@ -1755,7 +1756,6 @@
<exports symbol='xmlValidityWarningFunc' type='function'/>
<exports symbol='xmlValidatePopElement' type='function'/>
<exports symbol='xmlFreeEnumeration' type='function'/>
<exports symbol='xmlValidateNamesValue' type='function'/>
<exports symbol='xmlCopyEnumeration' type='function'/>
<exports symbol='xmlGetDtdAttrDesc' type='function'/>
<exports symbol='xmlValidateDtd' type='function'/>
@ -3452,15 +3452,15 @@
<exports symbol='XPATH_ENCODING_ERROR' type='enum'/>
<exports symbol='XPTR_RESOURCE_ERROR' type='enum'/>
<exports symbol='XPATH_NUMBER' type='enum'/>
<exports symbol='XPATH_INVALID_CTXT_SIZE' type='enum'/>
<exports symbol='XPATH_POINT' type='enum'/>
<exports symbol='XPATH_USERS' type='enum'/>
<exports symbol='XPATH_UNDEF_PREFIX_ERROR' type='enum'/>
<exports symbol='XPATH_UNKNOWN_FUNC_ERROR' type='enum'/>
<exports symbol='XPATH_INVALID_CTXT_SIZE' type='enum'/>
<exports symbol='XPATH_RANGE' type='enum'/>
<exports symbol='XPTR_SYNTAX_ERROR' type='enum'/>
<exports symbol='XPATH_LOCATIONSET' type='enum'/>
<exports symbol='XPATH_INVALID_CTXT' type='enum'/>
<exports symbol='XPATH_POINT' type='enum'/>
<exports symbol='XPATH_INVALID_ARITY' type='enum'/>
<exports symbol='XPATH_STRING' type='enum'/>
<exports symbol='XPATH_INVALID_PREDICATE_ERROR' type='enum'/>

View File

@ -5332,6 +5332,8 @@ xmlParseElementChildrenContentDecl (xmlParserCtxtPtr ctxt, int inputchk) {
}
} else {
xmlFatalErr(ctxt, XML_ERR_ELEMCONTENT_NOT_FINISHED, NULL);
if ((last != NULL) && (last != ret))
xmlFreeDocElementContent(ctxt->myDoc, last);
if (ret != NULL)
xmlFreeDocElementContent(ctxt->myDoc, ret);
return(NULL);

View File

View File

@ -0,0 +1,15 @@
./test/errors/content1.xml:7: parser error : ContentDecl : ',' '|' or ')' expected
<!ELEMENT aElement (a |b * >
^
./test/errors/content1.xml:7: parser error : expected '>'
<!ELEMENT aElement (a |b * >
^
./test/errors/content1.xml:7: parser error : internal error
<!ELEMENT aElement (a |b * >
^
./test/errors/content1.xml:7: parser error : DOCTYPE improperly terminated
<!ELEMENT aElement (a |b * >
^
./test/errors/content1.xml:7: parser error : Start tag expected, '<' not found
<!ELEMENT aElement (a |b * >
^

View File

@ -0,0 +1,13 @@
./test/errors/content1.xml:7: parser error : ContentDecl : ',' '|' or ')' expected
<!ELEMENT aElement (a |b * >
^
./test/errors/content1.xml:7: parser error : expected '>'
<!ELEMENT aElement (a |b * >
^
./test/errors/content1.xml:7: parser error : internal error
<!ELEMENT aElement (a |b * >
^
./test/errors/content1.xml:7: parser error : DOCTYPE improperly terminated
<!ELEMENT aElement (a |b * >
^
./test/errors/content1.xml : failed to parse

10
test/errors/content1.xml Normal file
View File

@ -0,0 +1,10 @@
<?xml version="1.0"?>
<!DOCTYPE root [
<!ELEMENT root (#PCDATA)>
<!ELEMENT a ANY>
<!ELEMENT b ANY>
<!--* missing closing bracket in choice *-->
<!ELEMENT aElement (a |b * >
]>
<root>Any content</root>