Uploaded image for project: 'Xerces2-J'
  1. Xerces2-J
  2. XERCESJ-380

stackOverflow with maxOccurs over 5000 and less than unbounded

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.0.2
    • 2.9.1
    • None
    • Operating System: Windows XP
      Platform: PC
    • 10764

    Description

      On Windows XP and NT and 2000, when validating a document with the schema
      below, I get a stackOverflow. I've seen the overflow report in 2 different
      locations for different schemas:

      java.lang.StackOverflowError
      at org.apache.xerces.impl.xs.models.XSDFACM.postTreeBuildInit
      (XSDFACM.java:899)
      ....

      java.lang.StackOverflowError
      at org.apache.xerces.impl.xs.models.XSDFACM.calcFollowList
      (XSDFACM.java:732)
      ....

      Here's an example schema to reproduce the problem:

      <?xml version="1.0" encoding="UTF-8"?>
      <schema xmlns="http://www.w3.org/2001/XMLSchema"
      targetNamespace="http://www.iss.net/cpe/stackOverflow"
      xmlns:stackOverflow="http://www.iss.net/cpe/stackOverflow"
      elementFormDefault="qualified"
      attributeFormDefault="unqualified">

      <element name="policy" type="stackOverflow:PolicyType"/>

      <complexType name="PolicyType">
      <sequence>
      <!-- fails for me as low as 5000 and up -->
      <element name='sensitivity'
      type='stackOverflow:sensitivityType' minOccurs='0' maxOccurs='65535'/>
      </sequence>
      </complexType>

      <complexType name="sensitivityType">
      <attribute name="sensitivity" type="int" use="required"/>
      </complexType>
      </schema>

      Here's a code excerpt:
      DOMParser domParser = new DOMParser();
      domParser.setErrorHandler( errorHandler );
      domParser.setFeature( "http://xml.org/sax/features/namespaces", true );
      domParser.setFeature( "http://apache.org/xml/features/validation/schema",
      true );
      domParser.setFeature( "http://xml.org/sax/features/validation", true );
      domParser.setProperty( "http://apache.org/xml/properties/schema/external-
      schemaLocation", ....);
      domParser.parse( new InputSource( new StringReader( .... )) );

      Attachments

        Activity

          People

            mrglavas@ca.ibm.com Michael Glavassevich
            afuqua@iss.net afuqua
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: