You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by "PJ Fanning (Jira)" <ji...@apache.org> on 2021/10/21 00:06:00 UTC

[jira] [Resolved] (XMLBEANS-495) StackOverflowError when parsing a large number of characters in an XML element

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

PJ Fanning resolved XMLBEANS-495.
---------------------------------
    Resolution: Fixed

> StackOverflowError when parsing a large number of characters in an XML element
> ------------------------------------------------------------------------------
>
>                 Key: XMLBEANS-495
>                 URL: https://issues.apache.org/jira/browse/XMLBEANS-495
>             Project: XMLBeans
>          Issue Type: Bug
>          Components: Validator
>    Affects Versions: Version 2.6
>         Environment: All
>            Reporter: Mandy Warren
>            Assignee: PJ Fanning
>            Priority: Major
>             Fix For: Version 5.0.2
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> When XMLBeans validates a very long XML String (4000 or so chars), it generates a StackOverFlowError as shown below. In the schema for this element I have defined a pattern and a min/max length but XMLBeans is applying the pattern first before checking the length. The solution is the fix applied to the class RegularExpression in xerces - see https://issues.apache.org/jira/browse/XERCESJ-589 which went into version 2.11. 
> 	<xs:simpleType name="info">
> 		<xs:restriction base="xs:string">
> 			<xs:maxLength value="3"/>
> 			<xs:minLength value="2"/>
> 			<xs:pattern value="[A-Z0-9]+"/>
> 		</xs:restriction>
> 	</xs:simpleType>
> Exception in thread "main" java.lang.StackOverflowError
> 	at org.apache.xmlbeans.impl.regex.RegularExpression.matchString(RegularExpression.java:1662)
> 	at org.apache.xmlbeans.impl.regex.RegularExpression.matchString(RegularExpression.java:1872)
> 	at org.apache.xmlbeans.impl.regex.RegularExpression.matchString(RegularExpression.java:1872)
> 	at org.apache.xmlbeans.impl.regex.RegularExpression.matchString(RegularExpression.java:1872)
> 	at org.apache.xmlbeans.impl.regex.RegularExpression.matchString(RegularExpression.java:1872)
> 	at org.apache.xmlbeans.impl.regex.RegularExpression.matchString(RegularExpression.java:1872)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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