You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by fa...@apache.org on 2023/03/25 20:09:30 UTC

svn commit: r1908716 - /poi/trunk/poi/src/main/java/org/apache/poi/util/IOUtils.java

Author: fanningpj
Date: Sat Mar 25 20:09:30 2023
New Revision: 1908716

URL: http://svn.apache.org/viewvc?rev=1908716&view=rev
Log:
don't share the skip bytes buffer

Modified:
    poi/trunk/poi/src/main/java/org/apache/poi/util/IOUtils.java

Modified: poi/trunk/poi/src/main/java/org/apache/poi/util/IOUtils.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/util/IOUtils.java?rev=1908716&r1=1908715&r2=1908716&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/util/IOUtils.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/util/IOUtils.java Sat Mar 25 20:09:30 2023
@@ -124,6 +124,12 @@ public final class IOUtils {
         }
     }
 
+    private static void checkByteSizeLimit(long length) {
+        if(BYTE_ARRAY_MAX_OVERRIDE != -1 && length > BYTE_ARRAY_MAX_OVERRIDE) {
+            throwRFE(length, BYTE_ARRAY_MAX_OVERRIDE);
+        }
+    }
+
     /**
      * Peeks at the first N bytes of the stream. Returns those bytes, but
      *  with the stream unaffected. Requires a stream that supports mark/reset,
@@ -539,7 +545,7 @@ public final class IOUtils {
     public static byte[] safelyAllocate(long length, int maxLength) {
         safelyAllocateCheck(length, maxLength);
 
-        checkByteSizeLimit((int)length);
+        checkByteSizeLimit(length);
 
         return new byte[(int)length];
     }
@@ -570,8 +576,6 @@ public final class IOUtils {
     }
 
 
-
-
     /**
      * Simple utility function to check that you haven't hit EOF
      * when reading a byte.



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