summaryrefslogtreecommitdiffstats
path: root/poi
diff options
context:
space:
mode:
authorPJ Fanning <fanningpj@apache.org>2022-03-11 21:24:51 +0000
committerPJ Fanning <fanningpj@apache.org>2022-03-11 21:24:51 +0000
commitf4bfcaeec9c08e1a6ef7bf3ffcb8c3085dd92b7b (patch)
tree3bc73f49f2226a8f85ec31335c0df845b3fe4691 /poi
parente7f9cd277d400e1a726d4b5acfe5c9ddf21a4eee (diff)
downloadpoi-f4bfcaeec9c08e1a6ef7bf3ffcb8c3085dd92b7b.tar.gz
poi-f4bfcaeec9c08e1a6ef7bf3ffcb8c3085dd92b7b.zip
fix issue in IOUtils.toByteArrayWithMaxLength
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1898861 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi')
-rw-r--r--poi/src/main/java/org/apache/poi/util/IOUtils.java2
1 files changed, 1 insertions, 1 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 37ad46846f..f0dbc1aa99 100644
--- a/poi/src/main/java/org/apache/poi/util/IOUtils.java
+++ b/poi/src/main/java/org/apache/poi/util/IOUtils.java
@@ -202,7 +202,7 @@ public final class IOUtils {
}
final int derivedLen = Math.min(length, derivedMaxLength);
- final int bufferLen = isLengthKnown ? derivedLen : 4096;
+ final int bufferLen = isLengthKnown ? derivedLen : Math.min(4096, derivedLen);
try (UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream(bufferLen)) {
byte[] buffer = new byte[4096];
int totalBytes = 0, readBytes;