mirror of
https://github.com/apache/poi.git
synced 2026-02-27 20:40:08 +08:00
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
This commit is contained in:
parent
059283c9e6
commit
49526667ab
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user