You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by "Mukul Gandhi (JIRA)" <xe...@xml.apache.org> on 2012/07/16 22:07:33 UTC

[jira] [Resolved] (XERCESJ-1570) Stack overflow when validating XML with XML Schema (using 1.1)

     [ https://issues.apache.org/jira/browse/XERCESJ-1570?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mukul Gandhi resolved XERCESJ-1570.
-----------------------------------

    Resolution: Cannot Reproduce

as per the suggestion from OP, resolving this issue.
                
> Stack overflow when validating XML with XML Schema (using 1.1)
> --------------------------------------------------------------
>
>                 Key: XERCESJ-1570
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1570
>             Project: Xerces2-J
>          Issue Type: Bug
>          Components: XML Schema 1.1 Datatypes
>    Affects Versions: 2.11.0
>            Reporter: Radu Coravu
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> The XML is like:
> <?xml version="1.0" encoding="UTF-8"?>
> <personnel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>      xsi:noNamespaceSchemaLocation="personal.xsd">
>     <person  xsi:type="testType"></person>
> </personnel>
> The XML Schema is like:
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
>     <xs:complexType name="testType"/>
>     <xs:element name="personnel">
>         <xs:complexType>
>             <xs:sequence>
>                 <xs:element ref="person" minOccurs="1" maxOccurs="unbounded"/>
>             </xs:sequence>
>         </xs:complexType>
>     </xs:element>
>     <xs:complexType name="fidji">
>         <xs:attribute name="attr"/>
>     </xs:complexType>
>     <xs:element name="person" type="fidji"/>    
> </xs:schema>
> The schema is parsed as an XML Schema 1.1 and then used to validate the XML.
> The stack overflow is like:
> java.lang.StackOverflowError
> 	at org.apache.xerces.impl.xs.XSConstraints.checkComplexDerivation(XSConstraints.java:216)
> 	at org.apache.xerces.impl.xs.XSConstraints.checkComplexDerivation(XSConstraints.java:241)
> 	at org.apache.xerces.impl.xs.XSConstraints.checkComplexDerivation(XSConstraints.java:241)
> 	at org.apache.xerces.impl.xs.XSConstraints.checkComplexDerivation(XSConstraints.java:241)
> 	at org.apache.xerces.impl.xs.XSConstraints.checkComplexDerivation(XSConstraints.java:241)
> 	at org.apache.xerces.impl.xs.XSConstraints.checkComplexDerivation(XSConstraints.java:241)
> 	at org.apache.xerces.impl.xs.XSConstraints.checkComplexDerivation(XSConstraints.java:241)
> 	at org.apache.xerces.impl.xs.XSConstraints.checkComplexDerivation(XSConstraints.java:241)
> 	at org.apache.xerces.impl.xs.XSConstraints.checkComplexDerivation(XSConstraints.java:241)
> 	at org.apache.xerces.impl.xs.XSConstraints.checkComplexDerivation(XSConstraints.java:241)
> 	at org.apache.xerces.impl.xs.XSConstraints.checkComplexDerivation(XSConstraints.java:241)
> 	at org.apache.xerces.impl.xs.XSConstraints.checkComplexDerivation(XSConstraints.java:241)
> 	at org.apache.xerces.impl.xs.XSConstraints.checkComplexDerivation(XSConstraints.java:241)
> 	at org.apache.xerces.impl.xs.XSConstraints.checkComplexDerivation(XSConstraints.java:241)
> 	at org.apache.xerces.impl.xs.XSConstraints.checkComplexDerivation(XSConstraints.java:241)
> at org.apache.xerces.impl.xs.XSConstraints.checkTypeDerivationOk(XSConstraints.java:118)
> 	at org.apache.xerces.impl.xs.XMLSchemaValidatorXerces.getAndCheckXsiType(XMLSchemaValidatorXerces.java:2959)
> 	at org.apache.xerces.impl.xs.XMLSchemaValidatorXerces.handleStartElement(XMLSchemaValidatorXerces.java:2252)
> 	at org.apache.xerces.impl.xs.XMLSchemaValidatorXerces.startElement(XMLSchemaValidatorXerces.java:815)
> 	at org.apache.xerces.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:87)
> 	at org.apache.xerces.xinclude.XIncludeHandler.startElement(XIncludeHandler.java:963)
> 	at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:268)
> 	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1655)
> I added some logging in XSConstraints, it has some recursive code like:
>  if (directBase.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE)
>             return checkComplexDerivation((XSComplexTypeDecl)directBase, base, block);
> which could be guarded to be something like:
> if (directBase.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE 
>             && directBase != derived
>             )

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: j-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-dev-help@xerces.apache.org