aboutsummaryrefslogtreecommitdiffstats
path: root/poi
diff options
context:
space:
mode:
authorDominik Stadler <centic@apache.org>2023-12-30 19:39:42 +0000
committerDominik Stadler <centic@apache.org>2023-12-30 19:39:42 +0000
commita27029d1af6600a73a18faf9675809006a9a515f (patch)
tree6b5d0a252184b89d82ffc569f68686cda514c54e /poi
parentd54c8f16e69e43ffb9af932997c4a2918ebad66e (diff)
downloadpoi-a27029d1af6600a73a18faf9675809006a9a515f.tar.gz
poi-a27029d1af6600a73a18faf9675809006a9a515f.zip
Bug 66425: Avoid exceptions found via poi-fuzz
Prevent NullPointerException Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=64212 git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1915006 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi')
-rw-r--r--poi/src/main/java/org/apache/poi/hssf/record/FeatRecord.java8
-rw-r--r--poi/src/test/java/org/apache/poi/hssf/dev/TestBiffViewer.java1
-rw-r--r--poi/src/test/java/org/apache/poi/hssf/dev/TestRecordLister.java2
3 files changed, 8 insertions, 3 deletions
diff --git a/poi/src/main/java/org/apache/poi/hssf/record/FeatRecord.java b/poi/src/main/java/org/apache/poi/hssf/record/FeatRecord.java
index a434658ba4..86e2fc8f57 100644
--- a/poi/src/main/java/org/apache/poi/hssf/record/FeatRecord.java
+++ b/poi/src/main/java/org/apache/poi/hssf/record/FeatRecord.java
@@ -132,13 +132,15 @@ public final class FeatRecord extends StandardRecord {
cellRef.serialize(out);
}
- sharedFeature.serialize(out);
+ if (sharedFeature != null) {
+ sharedFeature.serialize(out);
+ }
}
protected int getDataSize() {
return 12 + 2+1+4+2+4+2+
- (cellRefs.length * CellRangeAddress.ENCODED_SIZE)
- +sharedFeature.getDataSize();
+ (cellRefs.length * CellRangeAddress.ENCODED_SIZE) +
+ (sharedFeature == null ? 0 : sharedFeature.getDataSize());
}
public int getIsf_sharedFeatureType() {
diff --git a/poi/src/test/java/org/apache/poi/hssf/dev/TestBiffViewer.java b/poi/src/test/java/org/apache/poi/hssf/dev/TestBiffViewer.java
index 4655517e08..491d68d159 100644
--- a/poi/src/test/java/org/apache/poi/hssf/dev/TestBiffViewer.java
+++ b/poi/src/test/java/org/apache/poi/hssf/dev/TestBiffViewer.java
@@ -45,6 +45,7 @@ class TestBiffViewer extends BaseTestIteratingXLS {
excludes.put("clusterfuzz-testcase-minimized-POIHSSFFuzzer-5786329142919168.xls", IllegalStateException.class);
excludes.put("clusterfuzz-testcase-minimized-POIHSSFFuzzer-5889658057523200.xls", IndexOutOfBoundsException.class);
excludes.put("clusterfuzz-testcase-minimized-POIHSSFFuzzer-5175219985448960.xls", IndexOutOfBoundsException.class);
+ excludes.put("clusterfuzz-testcase-minimized-POIHSSFFuzzer-6137883240824832.xls", IndexOutOfBoundsException.class);
return excludes;
}
diff --git a/poi/src/test/java/org/apache/poi/hssf/dev/TestRecordLister.java b/poi/src/test/java/org/apache/poi/hssf/dev/TestRecordLister.java
index c04d994a43..7f1c1f4561 100644
--- a/poi/src/test/java/org/apache/poi/hssf/dev/TestRecordLister.java
+++ b/poi/src/test/java/org/apache/poi/hssf/dev/TestRecordLister.java
@@ -48,6 +48,8 @@ class TestRecordLister extends BaseTestIteratingXLS {
excludes.put("clusterfuzz-testcase-minimized-POIHSSFFuzzer-5786329142919168.xls", RecordFormatException.class);
excludes.put("clusterfuzz-testcase-minimized-POIHSSFFuzzer-5889658057523200.xls", IndexOutOfBoundsException.class);
excludes.put("clusterfuzz-testcase-minimized-POIHSSFFuzzer-5175219985448960.xls", RecordFormatException.class);
+ excludes.put("clusterfuzz-testcase-minimized-POIHSSFFuzzer-6137883240824832.xls", RecordFormatException.class);
+
return excludes;
}