aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--poi-integration/src/test/java/org/apache/poi/stress/TestAllFiles.java23
-rw-r--r--poi-scratchpad/src/main/java/org/apache/poi/hslf/usermodel/HSLFSlideShowImpl.java7
-rw-r--r--test-data/slideshow/clusterfuzz-testcase-minimized-POIHSLFFuzzer-6416153805979648.pptbin0 -> 15360 bytes
-rw-r--r--test-data/spreadsheet/stress.xlsbin60416 -> 60928 bytes
4 files changed, 22 insertions, 8 deletions
diff --git a/poi-integration/src/test/java/org/apache/poi/stress/TestAllFiles.java b/poi-integration/src/test/java/org/apache/poi/stress/TestAllFiles.java
index ed96cde4e8..5171158965 100644
--- a/poi-integration/src/test/java/org/apache/poi/stress/TestAllFiles.java
+++ b/poi-integration/src/test/java/org/apache/poi/stress/TestAllFiles.java
@@ -253,13 +253,22 @@ public class TestAllFiles {
Exception e = assertThrows((Class<? extends Exception>)exClass, exec, errPrefix + " expected " + exClass);
String actMsg = pathReplace(e.getMessage());
- // verify that message is either null for both or set for both
- assertTrue(actMsg != null || StringUtils.isBlank(exMessage),
- errPrefix + " for " + exClass + " expected message '" + exMessage + "' but had '" + actMsg + "'");
-
- if (actMsg != null) {
- assertTrue(actMsg.contains(exMessage),
- errPrefix + "Message: " + actMsg + " - didn't contain: " + exMessage);
+ // perform special handling of NullPointerException as
+ // JDK started to add more information in some newer JDK, so
+ // it sometimes has a message and sometimes not!
+ if (NullPointerException.class.isAssignableFrom(exClass)) {
+ if (actMsg != null) {
+ assertTrue(actMsg.contains(exMessage), errPrefix + "Message: "+actMsg+" - didn't contain: "+exMessage);
+ }
+ } else {
+ // verify that message is either null for both or set for both
+ assertTrue(actMsg != null || StringUtils.isBlank(exMessage),
+ errPrefix + " for " + exClass + " expected message '" + exMessage + "' but had '" + actMsg + "'");
+
+ if (actMsg != null) {
+ assertTrue(actMsg.contains(exMessage),
+ errPrefix + "Message: " + actMsg + " - didn't contain: " + exMessage);
+ }
}
} else {
assertDoesNotThrow(exec, errPrefix);
diff --git a/poi-scratchpad/src/main/java/org/apache/poi/hslf/usermodel/HSLFSlideShowImpl.java b/poi-scratchpad/src/main/java/org/apache/poi/hslf/usermodel/HSLFSlideShowImpl.java
index 54edf47faa..70fb287026 100644
--- a/poi-scratchpad/src/main/java/org/apache/poi/hslf/usermodel/HSLFSlideShowImpl.java
+++ b/poi-scratchpad/src/main/java/org/apache/poi/hslf/usermodel/HSLFSlideShowImpl.java
@@ -72,6 +72,7 @@ import org.apache.poi.poifs.crypt.EncryptionInfo;
import org.apache.poi.poifs.filesystem.DirectoryNode;
import org.apache.poi.poifs.filesystem.DocumentEntry;
import org.apache.poi.poifs.filesystem.DocumentInputStream;
+import org.apache.poi.poifs.filesystem.Entry;
import org.apache.poi.poifs.filesystem.EntryUtils;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.apache.poi.sl.usermodel.PictureData;
@@ -229,7 +230,11 @@ public final class HSLFSlideShowImpl extends POIDocument implements Closeable {
}
// Get the main document stream
- DocumentEntry docProps = (DocumentEntry)dir.getEntry(POWERPOINT_DOCUMENT);
+ final Entry entry = dir.getEntry(POWERPOINT_DOCUMENT);
+ if (!(entry instanceof DocumentEntry)) {
+ throw new IllegalArgumentException("Had unexpected type of entry for name: " + POWERPOINT_DOCUMENT + ": " + entry.getClass());
+ }
+ DocumentEntry docProps = (DocumentEntry) entry;
// Grab the document stream
int len = docProps.getSize();
diff --git a/test-data/slideshow/clusterfuzz-testcase-minimized-POIHSLFFuzzer-6416153805979648.ppt b/test-data/slideshow/clusterfuzz-testcase-minimized-POIHSLFFuzzer-6416153805979648.ppt
new file mode 100644
index 0000000000..a47bcf56be
--- /dev/null
+++ b/test-data/slideshow/clusterfuzz-testcase-minimized-POIHSLFFuzzer-6416153805979648.ppt
Binary files differ
diff --git a/test-data/spreadsheet/stress.xls b/test-data/spreadsheet/stress.xls
index 3018e322b3..3215a910a3 100644
--- a/test-data/spreadsheet/stress.xls
+++ b/test-data/spreadsheet/stress.xls
Binary files differ