This is an automated email from the ASF dual-hosted git repository.
pjfanning pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/poi.git
The following commit(s) were added to refs/heads/trunk by this push:
new b52cd57882 Update ExOleObjStg.java (#1087)
b52cd57882 is described below
commit b52cd578820edb7662b96ab8c5a0b215a714302e
Author: PJ Fanning <[email protected]>
AuthorDate: Tue May 26 04:16:17 2026 +0100
Update ExOleObjStg.java (#1087)
---
.../java/org/apache/poi/hslf/record/ExOleObjStg.java | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git
a/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/ExOleObjStg.java
b/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/ExOleObjStg.java
index 07818a081f..566686581c 100644
--- a/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/ExOleObjStg.java
+++ b/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/ExOleObjStg.java
@@ -17,7 +17,6 @@
package org.apache.poi.hslf.record;
-import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -29,6 +28,7 @@ import java.util.zip.DeflaterOutputStream;
import java.util.zip.InflaterInputStream;
import org.apache.commons.io.input.BoundedInputStream;
+import org.apache.commons.io.input.UnsynchronizedByteArrayInputStream;
import org.apache.commons.io.output.UnsynchronizedByteArrayOutputStream;
import org.apache.poi.util.GenericRecordUtil;
import org.apache.poi.util.IOUtils;
@@ -130,8 +130,12 @@ public class ExOleObjStg extends
PositionDependentRecordAtom implements PersistR
"Claimed uncompressed data size (" + size + ") exceeds
maximum allowed (" + MAX_RECORD_LENGTH + ")");
}
- InputStream compressedStream = new ByteArrayInputStream(_data, 4,
_data.length);
try {
+ InputStream compressedStream =
UnsynchronizedByteArrayInputStream
+ .builder()
+ .setByteArray(_data)
+ .setOffset(4)
+ .get();
return BoundedInputStream.builder()
.setInputStream(new InflaterInputStream(compressedStream))
.setMaxCount(size)
@@ -140,7 +144,14 @@ public class ExOleObjStg extends
PositionDependentRecordAtom implements PersistR
throw new UncheckedIOException(e);
}
} else {
- return new ByteArrayInputStream(_data, 0, _data.length);
+ try {
+ return UnsynchronizedByteArrayInputStream
+ .builder()
+ .setByteArray(_data)
+ .get();
+ } catch (IOException e) {
+ throw new UncheckedIOException(e);
+ }
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]