From 1c9e88d79e9c8f5cbb043fbb7440ef753e4dbda1 Mon Sep 17 00:00:00 2001 From: Yegor Kozlov Date: Sat, 20 Jun 2009 11:17:30 +0000 Subject: 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 --- .../org/apache/poi/ddf/TestEscherBlipRecord.java | 18 ++++++++++++++++++ src/testcases/org/apache/poi/ddf/data/47143.dat | Bin 0 -> 58024 bytes 2 files changed, 18 insertions(+) create mode 100755 src/testcases/org/apache/poi/ddf/data/47143.dat (limited to 'src/testcases/org/apache/poi/ddf') 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 Binary files /dev/null and b/src/testcases/org/apache/poi/ddf/data/47143.dat differ -- cgit v1.2.3