aboutsummaryrefslogtreecommitdiffstats
path: root/poi
diff options
context:
space:
mode:
authorDominik Stadler <centic@apache.org>2024-07-14 11:26:50 +0000
committerDominik Stadler <centic@apache.org>2024-07-14 11:26:50 +0000
commitfc17f113d8a14341bc753231877d0d9b3c312118 (patch)
tree9f733c6e7eadc9de7baef436a12c298cdc2e45d9 /poi
parent7601beb5921fa38fe654ebf8f26d717a4e1966ee (diff)
downloadpoi-fc17f113d8a14341bc753231877d0d9b3c312118.tar.gz
poi-fc17f113d8a14341bc753231877d0d9b3c312118.zip
Bug 66425: Avoid exceptions found via poi-fuzz
Prevent a ClassCastException Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=66089 git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1919214 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi')
-rw-r--r--poi/src/main/java/org/apache/poi/hssf/record/RecordInputStream.java3
-rw-r--r--poi/src/test/java/org/apache/poi/hssf/dev/BaseTestIteratingXLS.java1
2 files changed, 4 insertions, 0 deletions
diff --git a/poi/src/main/java/org/apache/poi/hssf/record/RecordInputStream.java b/poi/src/main/java/org/apache/poi/hssf/record/RecordInputStream.java
index caeac85d66..06420f394b 100644
--- a/poi/src/main/java/org/apache/poi/hssf/record/RecordInputStream.java
+++ b/poi/src/main/java/org/apache/poi/hssf/record/RecordInputStream.java
@@ -516,6 +516,9 @@ public final class RecordInputStream implements LittleEndianInput {
*/
@Internal
public void mark(int readlimit) {
+ if (!(_dataInput instanceof InputStream)) {
+ throw new IllegalStateException("Cannot use mark for dataInput of type " + _dataInput.getClass() + ", need an InputStream");
+ }
((InputStream)_dataInput).mark(readlimit);
_markedDataOffset = _currentDataOffset;
}
diff --git a/poi/src/test/java/org/apache/poi/hssf/dev/BaseTestIteratingXLS.java b/poi/src/test/java/org/apache/poi/hssf/dev/BaseTestIteratingXLS.java
index b239be7923..5ac8864f17 100644
--- a/poi/src/test/java/org/apache/poi/hssf/dev/BaseTestIteratingXLS.java
+++ b/poi/src/test/java/org/apache/poi/hssf/dev/BaseTestIteratingXLS.java
@@ -90,6 +90,7 @@ public abstract class BaseTestIteratingXLS {
excludes.put("clusterfuzz-testcase-minimized-POIHSSFFuzzer-6322470200934400.xls", RuntimeException.class);
excludes.put("clusterfuzz-testcase-minimized-POIHSSFFuzzer-4819588401201152.xls", RuntimeException.class);
excludes.put("clusterfuzz-testcase-minimized-POIHSSFFuzzer-6537773940867072.xls", RuntimeException.class);
+ excludes.put("clusterfuzz-testcase-minimized-POIHSSFFuzzer-4651309315719168.xls", RuntimeException.class);
return excludes;
}