[ 
https://issues.apache.org/jira/browse/XERCESJ-1702?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16616599#comment-16616599
 ] 

Mukul Gandhi commented on XERCESJ-1702:
---------------------------------------

Here are some more findings, from me.

When I use the following XML document, when parsing as suggested,

<?xml version="1.0"?>
<!DOCTYPE billion [
<!ELEMENT billion (#PCDATA)>
<!ENTITY laugh0 "a">
<!ENTITY laugh1 "&laugh0;&laugh0;">
<!ENTITY laugh2 "&laugh1;&laugh1;">
<!ENTITY laugh3 "&laugh2;&laugh2;">
<!ENTITY laugh4 "&laugh3;&laugh3;">
<!ENTITY laugh5 "&laugh4;&laugh4;">
<!ENTITY laugh6 "&laugh5;&laugh5;">
<!ENTITY laugh7 "&laugh6;&laugh6;">
<!ENTITY laugh8 "&laugh7;&laugh7;">
<!ENTITY laugh9 "&laugh8;&laugh8;">
<!ENTITY laugh10 "&laugh9;&laugh9;">
<!ENTITY laugh11 "&laugh10;&laugh10;">
<!ENTITY laugh12 "&laugh11;&laugh11;">
<!ENTITY laugh13 "&laugh12;&laugh12;">
<!ENTITY laugh14 "&laugh13;&laugh13;">
<!ENTITY laugh15 "&laugh14;&laugh14;">
<!ENTITY laugh16 "&laugh15;&laugh15;">
<!ENTITY laugh17 "&laugh16;&laugh16;">
<!ENTITY laugh18 "&laugh17;&laugh17;">
<!ENTITY laugh19 "&laugh18;&laugh18;">
<!ENTITY laugh20 "&laugh19;&laugh19;">
<!ENTITY laugh21 "&laugh20;&laugh20;">
<!ENTITY laugh22 "&laugh21;&laugh21;">
<!ENTITY laugh23 "&laugh22;&laugh22;">
<!ENTITY laugh24 "&laugh23;&laugh23;">
]>
<billion location="&laugh24;">text</billion>

I get java.lang.OutOfMemoryError.

(anything after <!ENTITY laugh23 "&laugh22;&laugh22;">, gives me 
java.lang.OutOfMemoryError. The failure point !ENTITY laugh23 may be specific 
to my local workstation, i.e it may depend on memory and CPU strength)

Please note following definition in XML in this comment,

ENTITY laugh0 "a"

(i.e value of entity laugh0 is very small) 

i.e java.lang.OutOfMemoryError is not due to a large value of ENTITY laugh0, 
but due to successive entity definitions.

After some more analysis, the reason of points in this comment, appears due to 
a memory leak.

> Parsing XML 
> ------------
>
>                 Key: XERCESJ-1702
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1702
>             Project: Xerces2-J
>          Issue Type: Bug
>    Affects Versions: 2.12.0
>            Reporter: Slava G
>            Priority: Major
>         Attachments: 1_e3e13f0e-7085-4000-a558-5d255ed7a944.xml
>
>
> Hi,
> When I'm trying to parse XML document using :
> _DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();_
> _DocumentBuilder builder = factory.newDocumentBuilder();_
> _builder.parse(File)_
>  
> The parsing is stuck in infinite loop:
> {{XMLDocumentScannerImpl(XMLScanner).scanAttributeValue(XMLString, XMLString, 
> String, boolean, String) line: not available }}
> {{ 
> XMLDocumentScannerImpl(XMLDocumentFragmentScannerImpl).scanAttribute(XMLAttributes)
>  line: not available }}
> {{ XMLDocumentScannerImpl(XMLDocumentFragmentScannerImpl).scanStartElement() 
> line: not available }}
> {{ XMLDocumentScannerImpl$ContentDispatcher.scanRootElementHook() line: not 
> available }}
> {{ 
> XMLDocumentScannerImpl$ContentDispatcher(XMLDocumentFragmentScannerImpl$FragmentContentDispatcher).dispatch(boolean)
>  line: not available }}
> {{ 
> XMLDocumentScannerImpl(XMLDocumentFragmentScannerImpl).scanDocument(boolean) 
> line: not available }}
> {{ XIncludeAwareParserConfiguration(XML11Configuration).parse(boolean) line: 
> not available }}
> {{ XIncludeAwareParserConfiguration(XML11Configuration).parse(XMLInputSource) 
> line: not available }}
> {{ DOMParser(XMLParser).parse(XMLInputSource) line: not available }}
> {{ DOMParser.parse(InputSource) line: not available }}
> {{ DocumentBuilderImpl.parse(InputSource) line: not available }}
> {{ DocumentBuilderImpl(DocumentBuilder).parse(File) line: 205}}
>  
> Please see attached XML file that cause this issue.
> Thanks



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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

Reply via email to