]> source.dussan.org Git - poi.git/commitdiff
Bug 66425: Avoid exceptions found via poi-fuzz
authorDominik Stadler <centic@apache.org>
Fri, 27 Oct 2023 10:08:04 +0000 (10:08 +0000)
committerDominik Stadler <centic@apache.org>
Fri, 27 Oct 2023 10:08:04 +0000 (10:08 +0000)
Fix one expected exception-text which is different
on newer Java versions

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=63143

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1913384 13f79535-47bb-0310-9956-ffa450edef68

poi-scratchpad/src/test/java/org/apache/poi/hslf/dev/BaseTestPPTIterating.java
poi-scratchpad/src/test/java/org/apache/poi/hslf/dev/TestPPTXMLDump.java
poi/src/main/java/org/apache/poi/poifs/crypt/agile/AgileEncryptionHeader.java
test-data/slideshow/clusterfuzz-testcase-minimized-POIHSLFFuzzer-4624961081573376.ppt [new file with mode: 0644]
test-data/spreadsheet/stress.xls

index 8b8845186d4068ea460d659cbf15ef9585cf3c63..be18652602a638a0b3fc06f7ab9a5d2cb84318f6 100644 (file)
@@ -69,6 +69,7 @@ public abstract class BaseTestPPTIterating {
         EXCLUDED.put("clusterfuzz-testcase-minimized-POIHSLFFuzzer-5231088823566336.ppt", FileNotFoundException.class);
         EXCLUDED.put("clusterfuzz-testcase-minimized-POIFuzzer-6411649193738240.ppt", FileNotFoundException.class);
         EXCLUDED.put("clusterfuzz-testcase-minimized-POIHSLFFuzzer-4838893004128256.ppt", FileNotFoundException.class);
+        EXCLUDED.put("clusterfuzz-testcase-minimized-POIHSLFFuzzer-4624961081573376.ppt", FileNotFoundException.class);
     }
 
     public static Stream<Arguments> files() {
index d2dd0b34b915a22b87c6e9b704448d7e50cd6450..ca4d09be24dc89c4ebf04ae573e5299686e2ad63 100644 (file)
@@ -68,7 +68,8 @@ public class TestPPTXMLDump extends BaseTestPPTIterating {
                 pFile.getName().equals("clusterfuzz-testcase-minimized-POIFuzzer-5681320547975168.ppt") ||
                 pFile.getName().equals("clusterfuzz-testcase-minimized-POIHSLFFuzzer-5231088823566336.ppt") ||
                 pFile.getName().equals("clusterfuzz-testcase-minimized-POIFuzzer-6411649193738240.ppt") ||
-                pFile.getName().equals("clusterfuzz-testcase-minimized-POIHSLFFuzzer-4838893004128256.ppt")) {
+                pFile.getName().equals("clusterfuzz-testcase-minimized-POIHSLFFuzzer-4838893004128256.ppt") ||
+                pFile.getName().equals("clusterfuzz-testcase-minimized-POIHSLFFuzzer-4624961081573376.ppt")) {
             throw new FileNotFoundException();
         }
     }
index fc2828ed0dd6cb49ff9d334d16a2a4be8ebc00ec..5540ba66cb37039b2b42f8dd486a649dff36018d 100644 (file)
@@ -69,7 +69,11 @@ public class AgileEncryptionHeader extends EncryptionHeader {
             throw new EncryptedDocumentException("Unsupported chaining mode - "+ keyData.getCipherChaining());
         }
 
-        int hashSize = keyData.getHashSize();
+        Integer hashSizeObj = keyData.getHashSize();
+        if (hashSizeObj == null) {
+            throw new EncryptedDocumentException("Invalid hash size: " + hashSizeObj);
+        }
+        int hashSize = hashSizeObj;
 
         HashAlgorithm ha = keyData.getHashAlgorithm();
         setHashAlgorithm(ha);
diff --git a/test-data/slideshow/clusterfuzz-testcase-minimized-POIHSLFFuzzer-4624961081573376.ppt b/test-data/slideshow/clusterfuzz-testcase-minimized-POIHSLFFuzzer-4624961081573376.ppt
new file mode 100644 (file)
index 0000000..bc3e4ae
Binary files /dev/null and b/test-data/slideshow/clusterfuzz-testcase-minimized-POIHSLFFuzzer-4624961081573376.ppt differ
index 203dae720a76220cb004ec0f77b011bf086f4080..7c42429886fc45460c405742a5c7110b7903a0aa 100644 (file)
Binary files a/test-data/spreadsheet/stress.xls and b/test-data/spreadsheet/stress.xls differ