aboutsummaryrefslogtreecommitdiffstats
path: root/src/ooxml/testcases/org/apache/poi/openxml4j
diff options
context:
space:
mode:
authorAndreas Beeker <kiwiwings@apache.org>2016-03-09 00:41:02 +0000
committerAndreas Beeker <kiwiwings@apache.org>2016-03-09 00:41:02 +0000
commitcddbdbee41a9f0753de21d3c19aed694887ca009 (patch)
tree8dc4b639db334816c098402ed56adc82cb3308da /src/ooxml/testcases/org/apache/poi/openxml4j
parentebac51fc6adb1c197f7164b71281ffa789888fa4 (diff)
downloadpoi-cddbdbee41a9f0753de21d3c19aed694887ca009.tar.gz
poi-cddbdbee41a9f0753de21d3c19aed694887ca009.zip
#57031 - Out of Memory when extracting text from attached files
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1734182 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/ooxml/testcases/org/apache/poi/openxml4j')
-rw-r--r--src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestPackage.java3
-rw-r--r--src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestZipPackage.java4
2 files changed, 5 insertions, 2 deletions
diff --git a/src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestPackage.java b/src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestPackage.java
index 25842cc556..35209dfada 100644
--- a/src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestPackage.java
+++ b/src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestPackage.java
@@ -781,7 +781,8 @@ public final class TestPackage {
}
}
- if(e.getMessage().startsWith("Zip bomb detected!")) {
+ String msg = e.getMessage();
+ if(msg != null && msg.startsWith("Zip bomb detected!")) {
return;
}
diff --git a/src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestZipPackage.java b/src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestZipPackage.java
index 74f5ea93e2..d292749e29 100644
--- a/src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestZipPackage.java
+++ b/src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestZipPackage.java
@@ -67,6 +67,8 @@ public class TestZipPackage {
assertTrue("Core not found in " + p.getParts(), foundCoreProps);
assertFalse("Document should not be found in " + p.getParts(), foundDocument);
assertFalse("Theme1 should not found in " + p.getParts(), foundTheme1);
+ p.close();
+ is.close();
}
@Test
@@ -89,7 +91,7 @@ public class TestZipPackage {
writer.close();
}
String string = new String(str.toByteArray(), "UTF-8");
- assertTrue("Had: " + string, string.contains("Exceeded Entity dereference bytes limit"));
+ assertTrue("Had: " + string, string.contains("The parser has encountered more than"));
}
@Test