bug-classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug classpath/23910] New: XML validation causes StackOverflowError


From: kaz at maczuka dot gcd dot org
Subject: [Bug classpath/23910] New: XML validation causes StackOverflowError
Date: 16 Sep 2005 07:15:17 -0000

Parse the following XML document with the program attached below,
and you will see a StackOverflowError.

<?xml version="1.0"?>
<!DOCTYPE a [
<!ELEMENT a (b*,c*)*>
<!ELEMENT b EMPTY>
<!ELEMENT c EMPTY>
]>
<a/>

Changing "<!ELEMENT a (b*,c*)*>" to "<!ELEMENT a (b*,c*)>" eliminates the
StackOverflowError.

The program to parse the XML document and the running results follow.
$ cat TestValidation.java
import javax.xml.parsers.*;
import org.xml.sax.*;
import org.xml.sax.helpers.DefaultHandler;

public class TestValidation {

    public static void main(String[] args) throws Exception {
        String uri = args[0];
        SAXParserFactory factory = SAXParserFactory.newInstance();
        XMLReader xr = factory.newSAXParser().getXMLReader();
        xr.setFeature("http://xml.org/sax/features/validation";, true);
        xr.setContentHandler(new DefaultHandler());
        xr.parse(uri);
    }
}
$ kaffe TestValidation file:///home/ito/0.xml
java.lang.StackOverflowError
   at gnu.xml.pipeline.ValidationConsumer$ChildrenRecognizer.completed 
(ValidationConsumer.java:line unknown, pc 0x80e8244)
   at gnu.xml.pipeline.ValidationConsumer$ChildrenRecognizer.completed 
(ValidationConsumer.java:1833)
   at gnu.xml.pipeline.ValidationConsumer$ChildrenRecognizer.completed 
(ValidationConsumer.java:1833)
   at gnu.xml.pipeline.ValidationConsumer$ChildrenRecognizer.completed 
(ValidationConsumer.java:1833)
...
   at gnu.xml.pipeline.ValidationConsumer$ChildrenRecognizer.completed 
(ValidationConsumer.java:1833)
   at gnu.xml.pipeline.ValidationConsumer.endElement 
(ValidationConsumer.java:1233)
   at gnu.xml.aelfred2.SAXDriver.endElement (SAXDriver.java:1128)
   at gnu.xml.aelfred2.XmlParser.parseElement (XmlParser.java:1393)
   at gnu.xml.aelfred2.XmlParser.parseDocument (XmlParser.java:578)
   at gnu.xml.aelfred2.XmlParser.doParse (XmlParser.java:463)
   at gnu.xml.aelfred2.SAXDriver.parse (SAXDriver.java:364)
   at gnu.xml.aelfred2.XmlReader.parse (XmlReader.java:365)
   at gnu.xml.aelfred2.XmlReader.parse (XmlReader.java:308)
   at TestValidation.main (TestValidation.java:13)
caused by:

-- 
           Summary: XML validation causes StackOverflowError
           Product: classpath
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: classpath
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: kaz at maczuka dot gcd dot org
                CC: bug-classpath at gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23910




reply via email to

[Prev in Thread] Current Thread [Next in Thread]