aboutsummaryrefslogtreecommitdiffstats
path: root/src/testcases/org/apache/poi/ddf
diff options
context:
space:
mode:
authorYegor Kozlov <yegor@apache.org>2009-06-20 11:17:30 +0000
committerYegor Kozlov <yegor@apache.org>2009-06-20 11:17:30 +0000
commit1c9e88d79e9c8f5cbb043fbb7440ef753e4dbda1 (patch)
tree96b6c5a249db5f18205426eae6ece996859d4645 /src/testcases/org/apache/poi/ddf
parent5766414a695810ac5052cd2fe67f1146571473c6 (diff)
downloadpoi-1c9e88d79e9c8f5cbb043fbb7440ef753e4dbda1.tar.gz
poi-1c9e88d79e9c8f5cbb043fbb7440ef753e4dbda1.zip
Fixed OOM in HSSFWorkbook#getAllPictures when reading .xls files containing metafiles, see Bugzilla 47143
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@786793 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases/org/apache/poi/ddf')
-rwxr-xr-xsrc/testcases/org/apache/poi/ddf/TestEscherBlipRecord.java18
-rwxr-xr-xsrc/testcases/org/apache/poi/ddf/data/47143.datbin0 -> 58024 bytes
2 files changed, 18 insertions, 0 deletions
diff --git a/src/testcases/org/apache/poi/ddf/TestEscherBlipRecord.java b/src/testcases/org/apache/poi/ddf/TestEscherBlipRecord.java
index 62c1f233b2..9e2921fe88 100755
--- a/src/testcases/org/apache/poi/ddf/TestEscherBlipRecord.java
+++ b/src/testcases/org/apache/poi/ddf/TestEscherBlipRecord.java
@@ -152,4 +152,22 @@ public final class TestEscherBlipRecord extends TestCase {
return data;
}
+ /**
+ * The test data was created from pl031405.xls attached to Bugzilla #47143
+ */
+ public void test47143() {
+ byte[] data = read(new File(cwd, "47143.dat"));
+ EscherBSERecord bse = new EscherBSERecord();
+ bse.fillFields(data, 0, new DefaultEscherRecordFactory());
+ bse.toString(); //assert that toString() works
+ assertTrue(bse.getBlipRecord() instanceof EscherMetafileBlip);
+
+ EscherMetafileBlip blip = (EscherMetafileBlip)bse.getBlipRecord();
+ blip.toString(); //assert that toString() works
+ byte[] remaining = blip.getRemainingData();
+ assertNotNull(remaining);
+
+ byte[] ser = bse.serialize(); //serialize and assert against the source data
+ assertTrue(Arrays.equals(data, ser));
+ }
}
diff --git a/src/testcases/org/apache/poi/ddf/data/47143.dat b/src/testcases/org/apache/poi/ddf/data/47143.dat
new file mode 100755
index 0000000000..0745ce1b99
--- /dev/null
+++ b/src/testcases/org/apache/poi/ddf/data/47143.dat
Binary files differ