aboutsummaryrefslogtreecommitdiffstats
path: root/poi-scratchpad
diff options
context:
space:
mode:
authorDominik Stadler <centic@apache.org>2023-01-01 15:59:48 +0000
committerDominik Stadler <centic@apache.org>2023-01-01 15:59:48 +0000
commit49526667ab578979f3167e490326b34222be895d (patch)
treeb5cf9aec52773b90ea3d5c1e7ceceeb237ce4ed0 /poi-scratchpad
parent059283c9e6cbfb65a2f5796de8b01bf13a28dd7f (diff)
downloadpoi-49526667ab578979f3167e490326b34222be895d.tar.gz
poi-49526667ab578979f3167e490326b34222be895d.zip
Change more assertions to proper checks
A broken input-document should not trigger assertions, but proper exceptions with useful information for the user git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1906327 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi-scratchpad')
-rw-r--r--poi-scratchpad/src/main/java/org/apache/poi/hslf/record/SSSlideInfoAtom.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/SSSlideInfoAtom.java b/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/SSSlideInfoAtom.java
index a0e330b4d4..89d26a6f30 100644
--- a/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/SSSlideInfoAtom.java
+++ b/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/SSSlideInfoAtom.java
@@ -192,7 +192,11 @@ public class SSSlideInfoAtom extends RecordAtom {
// Sanity Checking
if(len != 24) len = 24;
- assert(source.length >= offset+len);
+
+ if (source.length < offset+len) {
+ throw new IllegalArgumentException("Need at least " + (offset + len) +
+ " bytes with offset " + offset + ", length " + len + " and array-size " + source.length);
+ }
// Get the header
_header = Arrays.copyOfRange(source, ofs, ofs+8);
@@ -226,7 +230,7 @@ public class SSSlideInfoAtom extends RecordAtom {
ofs += LittleEndianConsts.SHORT_SIZE;
_speed = LittleEndian.getUByte(source, ofs);
ofs += LittleEndianConsts.BYTE_SIZE;
- _unused = Arrays.copyOfRange(source,ofs,ofs+3);
+ _unused = Arrays.copyOfRange(source, ofs,ofs+3);
}
/**