aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/java/org/apache/poi/util/IOUtils.java2
-rw-r--r--src/scratchpad/src/org/apache/poi/hwpf/HWPFDocumentCore.java4
2 files changed, 3 insertions, 3 deletions
diff --git a/src/java/org/apache/poi/util/IOUtils.java b/src/java/org/apache/poi/util/IOUtils.java
index 26f461f12d..68f5bbddc5 100644
--- a/src/java/org/apache/poi/util/IOUtils.java
+++ b/src/java/org/apache/poi/util/IOUtils.java
@@ -188,7 +188,7 @@ public final class IOUtils {
baos.write(buffer, 0, readBytes);
}
- checkByteSizeLimit(readBytes);
+ checkByteSizeLimit(totalBytes);
} while (totalBytes < len && readBytes > -1);
if (maxLength != Integer.MAX_VALUE && totalBytes == maxLength) {
diff --git a/src/scratchpad/src/org/apache/poi/hwpf/HWPFDocumentCore.java b/src/scratchpad/src/org/apache/poi/hwpf/HWPFDocumentCore.java
index 8910d6d669..66c3b51bcc 100644
--- a/src/scratchpad/src/org/apache/poi/hwpf/HWPFDocumentCore.java
+++ b/src/scratchpad/src/org/apache/poi/hwpf/HWPFDocumentCore.java
@@ -67,7 +67,7 @@ public abstract class HWPFDocumentCore extends POIDocument {
protected static final String STREAM_TABLE_1 = "1Table";
//arbitrarily selected; may need to increase
- private static final int MAX_RECORD_LENGTH = 1_000_000;
+ private static final int MAX_RECORD_LENGTH = 500_000_000;
/**
* Size of the not encrypted part of the FIB
@@ -328,7 +328,7 @@ public abstract class HWPFDocumentCore extends POIDocument {
try (DocumentInputStream dis = dir.createDocumentInputStream(documentProps);
InputStream is = isEncrypted ? getDecryptedStream(dis, streamSize, encryptionOffset) : dis) {
- return IOUtils.toByteArray(is, Math.min(streamSize, len));
+ return IOUtils.toByteArray(is, Math.min(streamSize, len), MAX_RECORD_LENGTH);
} catch (GeneralSecurityException e) {
throw new IOException("Unable to decrypt data for entry: "+name, e);
}