[jira] [Commented] (IMAGING-194) Tiff with JPEG,Zip compression fails to decompress

2023-11-11 Thread Gary Lucas (Jira)


[ 
https://issues.apache.org/jira/browse/IMAGING-194?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17785258#comment-17785258
 ] 

Gary Lucas commented on IMAGING-194:


I created test files using LibTIFF and ImageMagick.

 

Just submitted pull request 334.  This change enables the reading of TIFF files 
that use JPEG format for their internal coding.

Changes to be able to write files in this format will have to wait.  I am 
thinking that would be a separate issue.

> Tiff with JPEG,Zip compression fails to decompress
> --
>
> Key: IMAGING-194
> URL: https://issues.apache.org/jira/browse/IMAGING-194
> Project: Commons Imaging
>  Issue Type: Improvement
>  Components: Format: TIFF
>Affects Versions: 1.0-alpha1
>Reporter: Satya Deep Maheshwari
>Priority: Major
>
> Tiff with JPEG, Zip compression  fails to decompress with the below exception:
> {code}
> org.apache.commons.imaging.ImageReadException: Tiff: unknown/unsupported 
> compression: 7
>   at 
> org.apache.commons.imaging.formats.tiff.datareaders.DataReader.decompress(DataReader.java:215)
>   at 
> org.apache.commons.imaging.formats.tiff.datareaders.DataReaderStrips.readImageData(DataReaderStrips.java:210)
>   at 
> org.apache.commons.imaging.formats.tiff.TiffImageParser.getBufferedImage(TiffImageParser.java:650)
>   at 
> org.apache.commons.imaging.formats.tiff.TiffDirectory.getTiffImage(TiffDirectory.java:157)
>   at 
> org.apache.commons.imaging.formats.tiff.TiffImageParser.getBufferedImage(TiffImageParser.java:463)
>   at 
> org.apache.commons.imaging.Imaging.getBufferedImage(Imaging.java:1407)
>   at 
> org.apache.commons.imaging.Imaging.getBufferedImage(Imaging.java:1370)
> {code}
> From the 
> [documentation|https://commons.apache.org/proper/commons-imaging/formatsupport.html]
>  , it seems this compression format is not supported. Excerpt from the 
> document below:
> {quote}
> Supported through version 6.0. TIFFs is a open-ended container format, so 
> it's not possible to support every possibly variation. Supports Bi-Level, 
> Palette/Indexed, RGB, CMYK, YCbCr, CIELab and LOGLUV images. Supports reading 
> and writing LZW, CCITT Modified Huffman/Group 3/Group 4, and Packbits/RLE 
> compression. Notably missing other forms of compression though, including 
> JPEG. Supports reading Tiled images.
> {quote}
> This ticket is logged to add JPEG/Zip compression format support.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


Re: [PR] COMPRESS-650 lz4 index out of bounds [commons-compress]

2023-11-11 Thread via GitHub


cpreisler commented on code in PR #437:
URL: https://github.com/apache/commons-compress/pull/437#discussion_r1390313217


##
src/test/java/org/apache/commons/compress/compressors/lz4/FramedLZ4CompressorRoundtripTest.java:
##
@@ -104,15 +104,17 @@ private void roundTripTest(final String testFile, final 
FramedLZ4CompressorOutpu
 
 @Test
 public void test64KMultipleBlocks() throws IOException {
-final ByteArrayOutputStream buffer = new ByteArrayOutputStream();
-final byte[] expected = new byte[98304];
+ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+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( 
{
-assertArrayEquals(expected, IOUtils.toByteArray(sis));
+final byte[] actual = IOUtils.toByteArray(sis);
+assertArrayEquals(expected, actual);

Review Comment:
   This is gone. From my perspective this is good to go. Please let me know if 
you want any additional changes. I'm available tonight and tomorrow.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@commons.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] COMPRESS-650 lz4 index out of bounds [commons-compress]

2023-11-11 Thread via GitHub


cpreisler commented on code in PR #437:
URL: https://github.com/apache/commons-compress/pull/437#discussion_r1390310751


##
src/test/java/org/apache/commons/compress/compressors/lz4/FramedLZ4CompressorRoundtripTest.java:
##
@@ -104,15 +104,17 @@ private void roundTripTest(final String testFile, final 
FramedLZ4CompressorOutpu
 
 @Test
 public void test64KMultipleBlocks() throws IOException {
-final ByteArrayOutputStream buffer = new ByteArrayOutputStream();
-final byte[] expected = new byte[98304];
+ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+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( 
{
-assertArrayEquals(expected, IOUtils.toByteArray(sis));
+final byte[] actual = IOUtils.toByteArray(sis);
+assertArrayEquals(expected, actual);

Review Comment:
   let me try to get this out of here. Again, when I committed my changes the 
merge was showing conflicts with master, so that's how it got here.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@commons.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] COMPRESS-650 lz4 index out of bounds [commons-compress]

2023-11-11 Thread via GitHub


cpreisler commented on code in PR #437:
URL: https://github.com/apache/commons-compress/pull/437#discussion_r1390310674


##
src/test/java/org/apache/commons/compress/compressors/lz4/FramedLZ4CompressorOutputStreamTest.java:
##
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.commons.compress.compressors.lz4;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.util.Arrays;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import org.junit.jupiter.api.Test;
+
+/**
+ *
+ * @author Chad Preisler
+ */
+public class FramedLZ4CompressorOutputStreamTest {
+
+@Test
+public void testWriteByteArrayVsWriteByte() throws IOException {
+ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+StringBuilder sb = new StringBuilder();
+for (int i = 0; i < 1; i++) {

Review Comment:
   I got rid of the useless for loop. I reused my round trip code and this was 
left over crud. Thanks for catching this.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@commons.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] COMPRESS-650 lz4 index out of bounds [commons-compress]

2023-11-11 Thread via GitHub


cpreisler commented on code in PR #437:
URL: https://github.com/apache/commons-compress/pull/437#discussion_r1390310608


##
src/test/java/org/apache/commons/compress/compressors/lz4/FramedLZ4CompressorOutputStreamTest.java:
##
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.commons.compress.compressors.lz4;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.util.Arrays;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import org.junit.jupiter.api.Test;
+
+/**
+ *
+ * @author Chad Preisler

Review Comment:
   I removed the comment from the code.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@commons.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] COMPRESS-650 lz4 index out of bounds [commons-compress]

2023-11-11 Thread via GitHub


cpreisler commented on PR #437:
URL: https://github.com/apache/commons-compress/pull/437#issuecomment-1806932578

   I’ll get it done today.
   
   On Sat, Nov 11, 2023 at 3:30 PM Gary Gregory ***@***.***>
   wrote:
   
   > @cpreisler 
   > OK, ty for the update. FYI, I plan on cutting a release candidate this
   > weekend.
   >
   > —
   > Reply to this email directly, view it on GitHub
   > 
,
   > or unsubscribe
   > 

   > .
   > You are receiving this because you were mentioned.Message ID:
   > ***@***.***>
   >
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@commons.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] COMPRESS-650 lz4 index out of bounds [commons-compress]

2023-11-11 Thread via GitHub


garydgregory commented on PR #437:
URL: https://github.com/apache/commons-compress/pull/437#issuecomment-1806921936

   @cpreisler 
   OK, ty for the update. FYI, I plan on cutting a release candidate this 
weekend.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@commons.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] COMPRESS-650 lz4 index out of bounds [commons-compress]

2023-11-11 Thread via GitHub


cpreisler commented on PR #437:
URL: https://github.com/apache/commons-compress/pull/437#issuecomment-1806919375

   I’m away from my computer right now. Let me look this over and make sure
   the right code got committed. Something may have gotten messed up when I
   tried to revert the other change.
   
   On Sat, Nov 11, 2023 at 3:06 PM Gary Gregory ***@***.***>
   wrote:
   
   > ***@***. commented on this pull request.
   > --
   >
   > In
   > 
src/test/java/org/apache/commons/compress/compressors/lz4/FramedLZ4CompressorOutputStreamTest.java
   > 

   > :
   >
   > > +import java.io.IOException;
   > +import java.util.Arrays;
   > +import static org.junit.jupiter.api.Assertions.assertTrue;
   > +import org.junit.jupiter.api.Test;
   > +
   > +/**
   > + *
   > + * @author Chad Preisler
   > + */
   > +public class FramedLZ4CompressorOutputStreamTest {
   > +
   > +@Test
   > +public void testWriteByteArrayVsWriteByte() throws IOException {
   > +ByteArrayOutputStream buffer = new ByteArrayOutputStream();
   > +StringBuilder sb = new StringBuilder();
   > +for (int i = 0; i < 1; i++) {
   >
   > Why do you use a loop when this only done once?
   >
   > —
   > Reply to this email directly, view it on GitHub
   > 
,
   > or unsubscribe
   > 

   > .
   > You are receiving this because you were mentioned.Message ID:
   > ***@***.***>
   >
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@commons.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] COMPRESS-650 lz4 index out of bounds [commons-compress]

2023-11-11 Thread via GitHub


garydgregory commented on code in PR #437:
URL: https://github.com/apache/commons-compress/pull/437#discussion_r1390286209


##
src/test/java/org/apache/commons/compress/compressors/lz4/FramedLZ4CompressorOutputStreamTest.java:
##
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.commons.compress.compressors.lz4;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.util.Arrays;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import org.junit.jupiter.api.Test;
+
+/**
+ *
+ * @author Chad Preisler
+ */
+public class FramedLZ4CompressorOutputStreamTest {
+
+@Test
+public void testWriteByteArrayVsWriteByte() throws IOException {
+ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+StringBuilder sb = new StringBuilder();
+for (int i = 0; i < 1; i++) {

Review Comment:
   Why do you use a loop when this only done once?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@commons.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] COMPRESS-650 lz4 index out of bounds [commons-compress]

2023-11-11 Thread via GitHub


garydgregory commented on code in PR #437:
URL: https://github.com/apache/commons-compress/pull/437#discussion_r1390286159


##
src/test/java/org/apache/commons/compress/compressors/lz4/FramedLZ4CompressorOutputStreamTest.java:
##
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.commons.compress.compressors.lz4;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.util.Arrays;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import org.junit.jupiter.api.Test;
+
+/**
+ *
+ * @author Chad Preisler

Review Comment:
   We do not use author tags, please remove; instead you can say `Tests {@link 
TheClass}.`. You will be credited in `changes.xml` after the merge,



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@commons.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] COMPRESS-650 lz4 index out of bounds [commons-compress]

2023-11-11 Thread via GitHub


garydgregory commented on code in PR #437:
URL: https://github.com/apache/commons-compress/pull/437#discussion_r1390265464


##
src/test/java/org/apache/commons/compress/compressors/lz4/FramedLZ4CompressorRoundtripTest.java:
##
@@ -104,15 +104,17 @@ private void roundTripTest(final String testFile, final 
FramedLZ4CompressorOutpu
 
 @Test
 public void test64KMultipleBlocks() throws IOException {
-final ByteArrayOutputStream buffer = new ByteArrayOutputStream();
-final byte[] expected = new byte[98304];
+ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+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( 
{
-assertArrayEquals(expected, IOUtils.toByteArray(sis));
+final byte[] actual = IOUtils.toByteArray(sis);
+assertArrayEquals(expected, actual);

Review Comment:
   Hello @cpreisler 
   Same question as before:
   Why is this method different? Don't change it unless it is required. 
Non-required changes make PRs harder and longer to review.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@commons.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] COMPRESS-650 lz4 index out of bounds [commons-compress]

2023-11-11 Thread via GitHub


cpreisler commented on code in PR #437:
URL: https://github.com/apache/commons-compress/pull/437#discussion_r1390254401


##
src/test/java/org/apache/commons/compress/compressors/lz4/FramedLZ4CompressorRoundtripTest.java:
##
@@ -104,15 +104,18 @@ private void roundTripTest(final String testFile, final 
FramedLZ4CompressorOutpu
 
 @Test
 public void test64KMultipleBlocks() throws IOException {
-final ByteArrayOutputStream buffer = new ByteArrayOutputStream();
-final byte[] expected = new byte[98304];
+ByteArrayOutputStream buffer = new ByteArrayOutputStream();

Review Comment:
   You are correct. There was no functional changes. I guess I got a little 
confused during the initial commit of my changes today. I did remove the unused 
count variable. I will be more careful with my merge/commits in the future.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@commons.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] COMPRESS-650 lz4 index out of bounds [commons-compress]

2023-11-11 Thread via GitHub


garydgregory commented on code in PR #437:
URL: https://github.com/apache/commons-compress/pull/437#discussion_r1390251770


##
src/test/java/org/apache/commons/compress/compressors/lz4/FramedLZ4CompressorRoundtripTest.java:
##
@@ -104,15 +104,18 @@ private void roundTripTest(final String testFile, final 
FramedLZ4CompressorOutpu
 
 @Test
 public void test64KMultipleBlocks() throws IOException {
-final ByteArrayOutputStream buffer = new ByteArrayOutputStream();
-final byte[] expected = new byte[98304];
+ByteArrayOutputStream buffer = new ByteArrayOutputStream();

Review Comment:
   Hello @cpreisler 
   Thank you for your update.
   Why has this method changed? I can't spot the functional differences. Why is 
`count` declared but not used? Revert if this is just formatting or noise. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@commons.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] COMPRESS-650 lz4 index out of bounds [commons-compress]

2023-11-11 Thread via GitHub


cpreisler commented on PR #437:
URL: https://github.com/apache/commons-compress/pull/437#issuecomment-1806857769

   New class added and test are moved.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@commons.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] COMPRESS-650 lz4 index out of bounds [commons-compress]

2023-11-11 Thread via GitHub


garydgregory commented on PR #437:
URL: https://github.com/apache/commons-compress/pull/437#issuecomment-1806849972

   @cpreisler 
   Sure, might as well.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@commons.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[jira] [Commented] (COMPRESS-647) ArrayIndexOutOfBoundsException when reading Zip with data descriptor entries

2023-11-11 Thread Robin Schimpf (Jira)


[ 
https://issues.apache.org/jira/browse/COMPRESS-647?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17785182#comment-17785182
 ] 

Robin Schimpf commented on COMPRESS-647:


Thanks for fixing it!

> ArrayIndexOutOfBoundsException when reading Zip with data descriptor entries
> 
>
> Key: COMPRESS-647
> URL: https://issues.apache.org/jira/browse/COMPRESS-647
> Project: Commons Compress
>  Issue Type: Bug
>Affects Versions: 1.23.0
>Reporter: Robin Schimpf
>Priority: Major
> Fix For: 1.25.0
>
> Attachments: 
> crash-commons-compress-ZipArchiveInputStream-dataDescriptor
>
>
> The attached fuzzed zip file fails to open with the following test when the 
> {{allowStoredEntriesWithDataDescriptor}} value is {{true}}.
> {code:java}
> @ParameterizedTest
> @ValueSource(booleans = {true, false})
> public void zipInputStream(final boolean 
> allowStoredEntriesWithDataDescriptor) {
> try (ZipArchiveInputStream zIn = new 
> ZipArchiveInputStream(Files.newInputStream(Paths.get("crash-commons-compress-ZipArchiveInputStream-dataDescriptor")),
>  "UTF-8", false, allowStoredEntriesWithDataDescriptor)) {
> ZipArchiveEntry zae = zIn.getNextZipEntry();
> while (zae != null) {
> zae = zIn.getNextZipEntry();
> }
> } catch (IOException e) {
> // Ignore expected exception
> }
> } {code}
> The exception is
> {code:java}
> java.lang.ArrayIndexOutOfBoundsException: arraycopy: source index -6 out of 
> bounds for byte[512]    at java.base/java.lang.System.arraycopy(Native Method)
>     at 
> java.base/java.io.PushbackInputStream.unread(PushbackInputStream.java:232)
>     at 
> org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.pushback(ZipArchiveInputStream.java:979)
>     at 
> org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.bufferContainsSignature(ZipArchiveInputStream.java:471)
>     at 
> org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.readStoredEntry(ZipArchiveInputStream.java:1282)
>     at 
> org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.readStored(ZipArchiveInputStream.java:1211)
>     at 
> org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.read(ZipArchiveInputStream.java:1013)
>     at 
> org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.skip(ZipArchiveInputStream.java:1343)
>     at 
> org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.closeEntry(ZipArchiveInputStream.java:562)
>     at 
> org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.getNextZipEntry(ZipArchiveInputStream.java:735)
>     at 
> org.apache.commons.compress.archivers.zip.ZipArchiveInputStreamTest.zipInputStream(ZipArchiveInputStreamTest.java:765)
>  {code}
> I also tried to open the file with the ZipFile class and the crash does not 
> occure there. Seems to only affect the stream implementation with that 
> specific option.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (COMPRESS-632) Improve fuzzing coverage in oss-fuzz

2023-11-11 Thread Robin Schimpf (Jira)


[ 
https://issues.apache.org/jira/browse/COMPRESS-632?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17785181#comment-17785181
 ] 

Robin Schimpf commented on COMPRESS-632:


Thanks [~yakovsh] for tackling this!

> Improve fuzzing coverage in oss-fuzz
> 
>
> Key: COMPRESS-632
> URL: https://issues.apache.org/jira/browse/COMPRESS-632
> Project: Commons Compress
>  Issue Type: Improvement
>Reporter: Robin Schimpf
>Priority: Major
>
> Fuzzing the library brought great stability improvements in the last couple 
> releases. But the current integration in oss-fuzz has only a limited scope. 
> Fuzzing is only done on the following classes:
>  * SevenZFile
>  * TarFile
>  * ZipFile
> Additionally those fuzzing tests only open the file and are not reading the 
> file content.
> IMHO the tests should be expanded to cover the following:
>  * Fuzz all supported formats (stream based and file based)
>  * Read the whole fuzzed file
> I don't know if it makes sense to also fuzz archive creation. The only thing 
> which might be worth there would be the ArchiveEntries since fuzzing the file 
> content seems useless.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


Re: [PR] COMPRESS-650 lz4 index out of bounds [commons-compress]

2023-11-11 Thread via GitHub


cpreisler commented on PR #437:
URL: https://github.com/apache/commons-compress/pull/437#issuecomment-1806833610

   Shoot. I just noticed that I put the framed tests in the block tests class. 
Should I create a new test class for framed? Currently there is only the framed 
round trip class. The new tests aren't really round trip tests.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@commons.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[PR] COMPRESS-650 lz4 index out of bounds [commons-compress]

2023-11-11 Thread via GitHub


cpreisler opened a new pull request, #437:
URL: https://github.com/apache/commons-compress/pull/437

   I noticed that the change I made yesterday caused writing byte by byte to 
produces a different result than writing multiple bytes at one time. I fixed 
the code and added unit tests. Also I verified that this code is now producing 
the same output as the previous 1.24.0 version. Also verified that the lz4 
command line utility is able to decompress the output from this code.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@commons.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[jira] [Commented] (COLLECTIONS-849) Compilation with Java 21 fails with "error: addFirst(E#1) in AbstractLinkedList cannot implement addFirst(E#2) in List"

2023-11-11 Thread Alex Herbert (Jira)


[ 
https://issues.apache.org/jira/browse/COLLECTIONS-849?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17785154#comment-17785154
 ] 

Alex Herbert commented on COLLECTIONS-849:
--

This is a duplicate of COLLECTIONS-842.

Due to this issue Collections4 is not source compatible with JDK 21.

> Compilation with Java 21 fails with "error: addFirst(E#1) in 
> AbstractLinkedList cannot implement addFirst(E#2) in List"
> ---
>
> Key: COLLECTIONS-849
> URL: https://issues.apache.org/jira/browse/COLLECTIONS-849
> Project: Commons Collections
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 3.2.2, 4.4
>Reporter: Volkmar W. Pogatzki
>Priority: Major
> Attachments: build.log
>
>
> javac -source 1.8 -target 1.8 -d target/classes -encoding UTF-8 @sources.lst
> warning: [options] bootstrap class path not set in conjunction with -source 8
> warning: [options] source value 8 is obsolete and will be removed in a future 
> release
> warning: [options] target value 8 is obsolete and will be removed in a future 
> release
> warning: [options] To suppress warnings about obsolete options, use 
> -Xlint:-options.
> src/main/java/org/apache/commons/collections4/trie/AbstractPatriciaTrie.java:1158:
>  error: lastEntry() in AbstractPatriciaTrie cannot implement lastEntry() in 
> SequencedMap
> TrieEntry lastEntry() {
> ^
>   attempting to assign weaker access privileges; was public
>   where K#1,V#1,K#2,V#2 are type-variables:
> K#1 extends Object declared in class AbstractPatriciaTrie
> V#1 extends Object declared in class AbstractPatriciaTrie
> K#2 extends Object declared in interface SequencedMap
> V#2 extends Object declared in interface SequencedMap
> src/main/java/org/apache/commons/collections4/trie/AbstractPatriciaTrie.java:744:
>  error: firstEntry() in AbstractPatriciaTrie cannot implement firstEntry() in 
> SequencedMap
> TrieEntry firstEntry() {
> ^
>   attempting to assign weaker access privileges; was public
>   where K#1,V#1,K#2,V#2 are type-variables:
> K#1 extends Object declared in class AbstractPatriciaTrie
> V#1 extends Object declared in class AbstractPatriciaTrie
> K#2 extends Object declared in interface SequencedMap
> V#2 extends Object declared in interface SequencedMap
> src/main/java/org/apache/commons/collections4/trie/PatriciaTrie.java:65: 
> error: lastEntry() in AbstractPatriciaTrie cannot implement lastEntry() in 
> SequencedMap
> public class PatriciaTrie extends AbstractPatriciaTrie {
>^
>   attempting to assign weaker access privileges; was public
>   where K#1,V#1,K#2,V#2 are type-variables:
> K#1 extends Object declared in class AbstractPatriciaTrie
> V#1 extends Object declared in class AbstractPatriciaTrie
> K#2 extends Object declared in interface SequencedMap
> V#2 extends Object declared in interface SequencedMap
> src/main/java/org/apache/commons/collections4/list/AbstractLinkedList.java:340:
>  error: addLast(E#1) in AbstractLinkedList cannot implement addLast(E#2) in 
> List
> public boolean addLast(final E o) {
>^
>   return type boolean is not compatible with void
>   where E#1,E#2 are type-variables:
> E#1 extends Object declared in class AbstractLinkedList
> E#2 extends Object declared in interface List
> src/main/java/org/apache/commons/collections4/list/AbstractLinkedList.java:335:
>  error: addFirst(E#1) in AbstractLinkedList cannot implement addFirst(E#2) in 
> List
> public boolean addFirst(final E o) {
>^
>   return type boolean is not compatible with void
>   where E#1,E#2 are type-variables:
> E#1 extends Object declared in class AbstractLinkedList
> E#2 extends Object declared in interface List
> src/main/java/org/apache/commons/collections4/list/NodeCachingLinkedList.java:44:
>  error: addLast(E#1) in AbstractLinkedList cannot implement addLast(E#2) in 
> List
> public class NodeCachingLinkedList extends AbstractLinkedList 
> implements Serializable {
>^
>   return type boolean is not compatible with void
>   where E#1,E#2 are type-variables:
> E#1 extends Object declared in class AbstractLinkedList
> E#2 extends Object declared in interface List
> src/main/java/org/apache/commons/collections4/list/CursorableLinkedList.java:61:
>  error: addLast(E#1) in AbstractLinkedList cannot implement addLast(E#2) in 
> List
> public class CursorableLinkedList extends AbstractLinkedList implements 
> Serializable {
>^
>   return type boolean is not compatible with void
>   where E#1,E#2 are type-variables:
> E#1 extends Object declared in class AbstractLinkedList
> E#2 extends Object declared in