diff options
author | PJ Fanning <fanningpj@apache.org> | 2023-03-25 20:09:30 +0000 |
---|---|---|
committer | PJ Fanning <fanningpj@apache.org> | 2023-03-25 20:09:30 +0000 |
commit | 420c96f74ef6598bc96c8774d5397522803027e8 (patch) | |
tree | 1907bb884b23d25e8361b16c7ce23a37dc7e8382 /poi | |
parent | 9e53a4f7c28aeb9ae19cfcdc9e2e2a2c3060f82f (diff) | |
download | poi-420c96f74ef6598bc96c8774d5397522803027e8.tar.gz poi-420c96f74ef6598bc96c8774d5397522803027e8.zip |
don't share the skip bytes buffer
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1908716 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi')
-rw-r--r-- | poi/src/main/java/org/apache/poi/util/IOUtils.java | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/poi/src/main/java/org/apache/poi/util/IOUtils.java b/poi/src/main/java/org/apache/poi/util/IOUtils.java index a69f1b052f..6dd510fe39 100644 --- a/poi/src/main/java/org/apache/poi/util/IOUtils.java +++ b/poi/src/main/java/org/apache/poi/util/IOUtils.java @@ -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. |