]> source.dussan.org Git - poi.git/commitdiff
Bug 66425: Avoid exceptions found via poi-fuzz
authorDominik Stadler <centic@apache.org>
Wed, 17 Apr 2024 18:15:33 +0000 (18:15 +0000)
committerDominik Stadler <centic@apache.org>
Wed, 17 Apr 2024 18:15:33 +0000 (18:15 +0000)
Prevent a few NullPointerException

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

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

poi-examples/src/main/java/org/apache/poi/examples/xssf/eventusermodel/FromHowTo.java
test-data/spreadsheet/clusterfuzz-testcase-minimized-POIXSSFFuzzer-5089447305609216.xlsx [new file with mode: 0644]
test-data/spreadsheet/stress.xls

index 14d5fbd9e8e5c9d7797d9ff13efe2fad5994654d..fbe4f588224ac9ffa2f4c563dbffbf587caa988e 100644 (file)
@@ -136,7 +136,7 @@ public class FromHowTo {
             if(nextIsString && StringUtil.isNotBlank(lastContents)) {
                 Integer idx = Integer.valueOf(lastContents);
                 lastContents = lruCache.get(idx);
-                if (lastContents == null && !lruCache.containsKey(idx)) {
+                if (lastContents == null && !lruCache.containsKey(idx) && sst != null) {
                     lastContents = sst.getItemAt(idx).getString();
                     lruCache.put(idx, lastContents);
                 }
diff --git a/test-data/spreadsheet/clusterfuzz-testcase-minimized-POIXSSFFuzzer-5089447305609216.xlsx b/test-data/spreadsheet/clusterfuzz-testcase-minimized-POIXSSFFuzzer-5089447305609216.xlsx
new file mode 100644 (file)
index 0000000..7b30e5c
Binary files /dev/null and b/test-data/spreadsheet/clusterfuzz-testcase-minimized-POIXSSFFuzzer-5089447305609216.xlsx differ
index 1e6d98a3a8e79874d08fb18fa4a02b3a7cde6376..f32cb34e1611cd30c6dc4e7bf07c488a82604dec 100644 (file)
Binary files a/test-data/spreadsheet/stress.xls and b/test-data/spreadsheet/stress.xls differ