aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/scratchpad/src/org/apache/poi/hslf/HSLFSlideShow.java13
-rw-r--r--src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestBugs.java15
-rw-r--r--test-data/slideshow/bug56240.pptbin0 -> 1358336 bytes
3 files changed, 24 insertions, 4 deletions
diff --git a/src/scratchpad/src/org/apache/poi/hslf/HSLFSlideShow.java b/src/scratchpad/src/org/apache/poi/hslf/HSLFSlideShow.java
index 3c63317c62..55c3f6f876 100644
--- a/src/scratchpad/src/org/apache/poi/hslf/HSLFSlideShow.java
+++ b/src/scratchpad/src/org/apache/poi/hslf/HSLFSlideShow.java
@@ -173,9 +173,8 @@ public final class HSLFSlideShow extends POIDocument {
* @param dir the POIFS directory to read from
* @throws IOException if there is a problem while parsing the document.
*/
- public HSLFSlideShow(DirectoryNode dir) throws IOException
- {
- super(dir);
+ public HSLFSlideShow(DirectoryNode dir) throws IOException {
+ super(handleDualStorage(dir));
// First up, grab the "Current User" stream
// We need this before we can detect Encrypted Documents
@@ -192,7 +191,13 @@ public final class HSLFSlideShow extends POIDocument {
readOtherStreams();
}
-
+ private static DirectoryNode handleDualStorage(DirectoryNode dir) throws IOException {
+ // when there's a dual storage entry, use it, as the outer document can't be read quite probably ...
+ String dualName = "PP97_DUALSTORAGE";
+ if (!dir.hasEntry(dualName)) return dir;
+ dir = (DirectoryNode)dir.getEntry(dualName);
+ return dir;
+ }
/**
* Constructs a new, empty, Powerpoint document.
diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestBugs.java b/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestBugs.java
index 6e7663d269..d3a759c9bf 100644
--- a/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestBugs.java
+++ b/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestBugs.java
@@ -610,4 +610,19 @@ public final class TestBugs {
inputStream.close();
}
}
+
+ @Test
+ public void bug56240() throws Exception {
+ InputStream inputStream = new FileInputStream(_slTests.getFile("bug56240.ppt"));
+ try {
+ SlideShow slideShow = new SlideShow(inputStream);
+ int slideCnt = slideShow.getSlides().length;
+ assertEquals(105, slideCnt);
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ slideShow.write(bos);
+ bos.close();
+ } finally {
+ inputStream.close();
+ }
+ }
}
diff --git a/test-data/slideshow/bug56240.ppt b/test-data/slideshow/bug56240.ppt
new file mode 100644
index 0000000000..908f2ccb06
--- /dev/null
+++ b/test-data/slideshow/bug56240.ppt
Binary files differ