You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2018/08/01 16:36:55 UTC
[Bug 62592] New: StackOverflow on corrupt ooxml files
https://bz.apache.org/bugzilla/show_bug.cgi?id=62592
Bug ID: 62592
Summary: StackOverflow on corrupt ooxml files
Product: POI
Version: 4.0-dev
Hardware: PC
Status: NEW
Severity: blocker
Priority: P2
Component: OPC
Assignee: dev@poi.apache.org
Reporter: tallison@mitre.org
Target Milestone: ---
Created attachment 36064
--> https://bz.apache.org/bugzilla/attachment.cgi?id=36064&action=edit
triggering document
In running 4.0.0-SNAPSHOT against our regression set, I found a SO exception
triggered by corrupt files.
Code:
OPCPackage.open(p.toFile());
With 4.0.0-SNAPSHOT, I get:
java.lang.StackOverflowError
at java.base/java.security.AccessController.doPrivileged(Native Method)
at
java.base/jdk.internal.loader.URLClassPath$JarLoader.ensureOpen(URLClassPath.java:741)
at
java.base/jdk.internal.loader.URLClassPath$JarLoader.<init>(URLClassPath.java:716)
at
java.base/jdk.internal.loader.URLClassPath$JarLoader$3.run(URLClassPath.java:968)
at
java.base/jdk.internal.loader.URLClassPath$JarLoader$3.run(URLClassPath.java:966)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at
java.base/jdk.internal.loader.URLClassPath$JarLoader.getResource(URLClassPath.java:965)
at
java.base/jdk.internal.loader.URLClassPath$JarLoader.getResource(URLClassPath.java:926)
at
java.base/jdk.internal.loader.URLClassPath$JarLoader.findResource(URLClassPath.java:901)
at
java.base/jdk.internal.loader.URLClassPath.findResource(URLClassPath.java:282)
at
java.base/jdk.internal.loader.BuiltinClassLoader.findResourceOnClassPath(BuiltinClassLoader.java:479)
at
java.base/jdk.internal.loader.BuiltinClassLoader.findResource(BuiltinClassLoader.java:303)
at java.base/java.lang.ClassLoader.getResource(ClassLoader.java:1400)
at
java.base/java.lang.ClassLoader.getResourceAsStream(ClassLoader.java:1736)
at org.apache.xerces.parsers.SecuritySupport$6.run(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at
org.apache.xerces.parsers.SecuritySupport.getResourceAsStream(Unknown Source)
at
org.apache.xerces.parsers.ObjectFactory.findJarServiceProvider(Unknown Source)
at org.apache.xerces.parsers.ObjectFactory.createObject(Unknown Source)
at org.apache.xerces.parsers.ObjectFactory.createObject(Unknown Source)
at org.apache.xerces.parsers.DOMParser.<init>(Unknown Source)
at org.apache.xerces.parsers.DOMParser.<init>(Unknown Source)
at org.apache.xerces.jaxp.DocumentBuilderImpl.<init>(Unknown Source)
at
org.apache.xerces.jaxp.DocumentBuilderFactoryImpl.newDocumentBuilder(Unknown
Source)
at
org.apache.poi.ooxml.util.DocumentHelper.newDocumentBuilder(DocumentHelper.java:89)
at
org.apache.poi.ooxml.util.DocumentHelper.readDocument(DocumentHelper.java:147)
...
With POI 3.17, we get:
org.apache.poi.openxml4j.exceptions.InvalidFormatException: The part
/_rels/.rels does not have any content type ! Rule: Package require content
types when retrieving a part from a package. [M.1.14]
at
org.apache.poi.openxml4j.opc.ZipPackage.getPartsImpl(ZipPackage.java:341)
at
org.apache.poi.openxml4j.opc.OPCPackage.getParts(OPCPackage.java:756)
at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:298)
at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:201)
at
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 62592] StackOverflow on corrupt ooxml files in 4.0.0-SNAPSHOT
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62592
--- Comment #1 from Tim Allison <ta...@mitre.org> ---
Sorry, SO _error_...of course...
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 62592] StackOverflow on corrupt ooxml files in 4.0.0-SNAPSHOT
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62592
--- Comment #2 from Tim Allison <ta...@mitre.org> ---
And w Java 8:
java.lang.StackOverflowError
at java.security.AccessController.doPrivileged(Native Method)
at sun.misc.URLClassPath$JarLoader.ensureOpen(URLClassPath.java:868)
at sun.misc.URLClassPath$JarLoader.<init>(URLClassPath.java:841)
at sun.misc.URLClassPath$JarLoader$3.run(URLClassPath.java:1094)
at sun.misc.URLClassPath$JarLoader$3.run(URLClassPath.java:1091)
at java.security.AccessController.doPrivileged(Native Method)
at sun.misc.URLClassPath$JarLoader.getResource(URLClassPath.java:1090)
at sun.misc.URLClassPath$JarLoader.getResource(URLClassPath.java:1050)
at sun.misc.URLClassPath$JarLoader.findResource(URLClassPath.java:1020)
at sun.misc.URLClassPath.findResource(URLClassPath.java:215)
at java.net.URLClassLoader$2.run(URLClassLoader.java:569)
at java.net.URLClassLoader$2.run(URLClassLoader.java:567)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findResource(URLClassLoader.java:566)
at java.lang.ClassLoader.getResource(ClassLoader.java:1096)
at java.net.URLClassLoader.getResourceAsStream(URLClassLoader.java:232)
at org.apache.xerces.parsers.SecuritySupport$6.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at
org.apache.xerces.parsers.SecuritySupport.getResourceAsStream(Unknown Source)
at
org.apache.xerces.parsers.ObjectFactory.findJarServiceProvider(Unknown Source)
at org.apache.xerces.parsers.ObjectFactory.createObject(Unknown Source)
at org.apache.xerces.parsers.ObjectFactory.createObject(Unknown Source)
at org.apache.xerces.parsers.DOMParser.<init>(Unknown Source)
at org.apache.xerces.parsers.DOMParser.<init>(Unknown Source)
at org.apache.xerces.jaxp.DocumentBuilderImpl.<init>(Unknown Source)
at
org.apache.xerces.jaxp.DocumentBuilderFactoryImpl.newDocumentBuilder(Unknown
Source)
at
org.apache.poi.ooxml.util.DocumentHelper.newDocumentBuilder(DocumentHelper.java:89)
at
org.apache.poi.ooxml.util.DocumentHelper.readDocument(DocumentHelper.java:147)
at
org.apache.poi.openxml4j.opc.internal.ContentTypeManager.parseContentTypesFile(ContentTypeManager.java:375)
at
org.apache.poi.openxml4j.opc.internal.ContentTypeManager.<init>(ContentTypeManager.java:100)
at
org.apache.poi.openxml4j.opc.internal.ZipContentTypeManager.<init>(ZipContentTypeManager.java:54)
at
org.apache.poi.openxml4j.opc.ZipPackage.getPartsImpl(ZipPackage.java:255)
at
org.apache.poi.openxml4j.opc.OPCPackage.getParts(OPCPackage.java:725)
at org.apache.poi.openxml4j.opc.OPCPackage.getPart(OPCPackage.java:603)
at
org.apache.poi.openxml4j.opc.internal.ContentTypeManager.getContentType(ContentTypeManager.java:339)
at
org.apache.poi.openxml4j.opc.ZipPackage$EntryTriple.<init>(ZipPackage.java:317)
at
org.apache.poi.openxml4j.opc.ZipPackage.lambda$getPartsImpl$0(ZipPackage.java:284)
at
java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
at
java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382)
at
java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
at
java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
at
java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
at
java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at
java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
at
org.apache.poi.openxml4j.opc.ZipPackage.getPartsImpl(ZipPackage.java:287)
at
org.apache.poi.openxml4j.opc.OPCPackage.getParts(OPCPackage.java:725)
at org.apache.poi.openxml4j.opc.OPCPackage.getPart(OPCPackage.java:603)
at
org.apache.poi.openxml4j.opc.internal.ContentTypeManager.getContentType(ContentTypeManager.java:339)
at
org.apache.poi.openxml4j.opc.ZipPackage$EntryTriple.<init>(ZipPackage.java:317)
at
org.apache.poi.openxml4j.opc.ZipPackage.lambda$getPartsImpl$0(ZipPackage.java:284)
at
java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 62592] StackOverflow on standalone ThemeManager files in
4.0.0-SNAPSHOT
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62592
Tim Allison <ta...@mitre.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|StackOverflow on corrupt |StackOverflow on standalone
|ooxml files in |ThemeManager files in
|4.0.0-SNAPSHOT |4.0.0-SNAPSHOT
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 62592] StackOverflow on standalone ThemeManager files in
4.0.0-SNAPSHOT
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62592
--- Comment #4 from Tim Allison <ta...@mitre.org> ---
Created attachment 36069
--> https://bz.apache.org/bugzilla/attachment.cgi?id=36069&action=edit
First draft patch
Not sure I like this patch, any recs for a better solution?
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 62592] StackOverflow on corrupt ooxml files in 4.0.0-SNAPSHOT
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62592
Tim Allison <ta...@mitre.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
OS| |All
Summary|StackOverflow on corrupt |StackOverflow on corrupt
|ooxml files |ooxml files in
| |4.0.0-SNAPSHOT
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 62592] StackOverflow on standalone ThemeManager files in
4.0.0-SNAPSHOT
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62592
--- Comment #5 from PJ Fanning <fa...@yahoo.com> ---
The patch seems ok to me as is.
But one alternative would be just to have a boolean member to keep track of
whether the ContentTypeManager has already been created. This could be extended
to a map to track other items that we are worried could lead to recursive stack
overflows.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 62592] StackOverflow on standalone ThemeManager files in
4.0.0-SNAPSHOT
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62592
Tim Allison <ta...@mitre.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
--- Comment #6 from Tim Allison <ta...@mitre.org> ---
r1837658
Thank you, PJ! We can change if needed.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 62592] StackOverflow on standalone ThemeManager files in
4.0.0-SNAPSHOT
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62592
--- Comment #3 from Tim Allison <ta...@mitre.org> ---
Sorry, the files are not corrupt zip files. I can open them with
commons-compress and WinZip...they appear to contain only ThemeManager
info...any idea what these are?
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org