This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-compress.git
The following commit(s) were added to refs/heads/master by this push:
new 2de705705 [COMPRESS-650] LZ4 compressor throws
IndexOutOfBoundsException
2de705705 is described below
commit 2de7057052b311cf30874da266331df85931b868
Author: Gary Gregory <[email protected]>
AuthorDate: Thu Nov 9 15:16:59 2023 -0500
[COMPRESS-650] LZ4 compressor throws IndexOutOfBoundsException
Use final, remove unused
---
src/changes/changes.xml | 1 +
.../compressors/lz4/FramedLZ4CompressorRoundtripTest.java | 13 +++++--------
2 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 13c7d0161..6448265ed 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -85,6 +85,7 @@ The <action> type attribute can be add,update,fix,remove.
<action type="fix" dev="ggregory" due-to="Gary Gregory">Refactor
internal SevenZ AES256SHA256Decoder OutputStream into a named static inner
class.</action>
<action type="fix" dev="ggregory" due-to="Gary Gregory">Use the root
Locale for string conversion of command line options in
org.apache.commons.compress.archivers.sevenz.CLI.</action>
<action type="fix" dev="ggregory" due-to="Gary Gregory">Calling
PackingUtils.config(PackingOptions) with null now closes the internal
FileHandler.</action>
+ <action type="fix" issue="COMPRESS-650" dev="ggregory" due-to="Chad
Preisler">LZ4 compressor throws IndexOutOfBoundsException.</action>
<!-- UPDATE -->
<action type="update" dev="ggregory" due-to="Dependabot">Bump
org.slf4j:slf4j-api from 2.0.8 to 2.0.9 #413.</action>
<action type="update" dev="ggregory" due-to="Gary Gregory">Bump
commons-io:commons-io from 2.13.0 to 2.15.0.</action>
diff --git
a/src/test/java/org/apache/commons/compress/compressors/lz4/FramedLZ4CompressorRoundtripTest.java
b/src/test/java/org/apache/commons/compress/compressors/lz4/FramedLZ4CompressorRoundtripTest.java
index 2cee5d433..19be661ab 100644
---
a/src/test/java/org/apache/commons/compress/compressors/lz4/FramedLZ4CompressorRoundtripTest.java
+++
b/src/test/java/org/apache/commons/compress/compressors/lz4/FramedLZ4CompressorRoundtripTest.java
@@ -104,18 +104,15 @@ public final class FramedLZ4CompressorRoundtripTest
extends AbstractTest {
@Test
public void test64KMultipleBlocks() throws IOException {
- ByteArrayOutputStream buffer = new ByteArrayOutputStream();
- int count = 0;
- byte[] expected = new byte[98304];
+ final ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+ final byte[] expected = new byte[98304];
new Random(0).nextBytes(expected);
- try (FramedLZ4CompressorOutputStream compressor =
- new FramedLZ4CompressorOutputStream(buffer,
- new
FramedLZ4CompressorOutputStream.Parameters(FramedLZ4CompressorOutputStream.BlockSize.K64,
true, false, false))) {
+ try (FramedLZ4CompressorOutputStream compressor = new
FramedLZ4CompressorOutputStream(buffer,
+ new
FramedLZ4CompressorOutputStream.Parameters(FramedLZ4CompressorOutputStream.BlockSize.K64,
true, false, false))) {
compressor.write(expected);
}
try (FramedLZ4CompressorInputStream sis = new
FramedLZ4CompressorInputStream(new ByteArrayInputStream(buffer.toByteArray())))
{
- final byte[] actual = IOUtils.toByteArray(sis);
- assertArrayEquals(expected, actual);
+ assertArrayEquals(expected, IOUtils.toByteArray(sis));
}
}
}