don't share the skip bytes buffer

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1908716 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
PJ Fanning 2023-03-25 20:09:30 +00:00
parent 9e53a4f7c2
commit 420c96f74e

View File

@ -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.