You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ce...@apache.org on 2023/01/01 15:59:48 UTC

svn commit: r1906327 - /poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/SSSlideInfoAtom.java

Author: centic
Date: Sun Jan  1 15:59:48 2023
New Revision: 1906327

URL: http://svn.apache.org/viewvc?rev=1906327&view=rev
Log:
Change more assertions to proper checks

A broken input-document should not trigger assertions,
but proper exceptions with useful information for the user

Modified:
    poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/SSSlideInfoAtom.java

Modified: poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/SSSlideInfoAtom.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/SSSlideInfoAtom.java?rev=1906327&r1=1906326&r2=1906327&view=diff
==============================================================================
--- poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/SSSlideInfoAtom.java (original)
+++ poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/SSSlideInfoAtom.java Sun Jan  1 15:59:48 2023
@@ -192,7 +192,11 @@ public class SSSlideInfoAtom extends Rec
 
         // 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 Rec
         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);
     }
 
     /**



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org