[ https://issues.apache.org/jira/browse/COMPRESS-545?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Stefan Bodewig updated COMPRESS-545: ------------------------------------ Fix Version/s: 1.21 > Decompression fails with ArrayIndexOutOfBoundsException > ------------------------------------------------------- > > Key: COMPRESS-545 > URL: https://issues.apache.org/jira/browse/COMPRESS-545 > Project: Commons Compress > Issue Type: Bug > Affects Versions: 1.20 > Reporter: Maksim Zuev > Priority: Major > Fix For: 1.21 > > Attachments: ArrayIndexOutOfBoundsException1.zip, > ArrayIndexOutOfBoundsException2.zip > > > This Kotlin code fails with exception(ArrayIndexOutOfBoundsException1.zip is > in the attachments) > Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index 30 > out of bounds for length 29Exception in thread "main" > java.lang.ArrayIndexOutOfBoundsException: Index 30 out of bounds for length > 29 at > org.apache.commons.compress.compressors.deflate64.HuffmanDecoder$HuffmanCodes.decodeNext(HuffmanDecoder.java:321) > at > org.apache.commons.compress.compressors.deflate64.HuffmanDecoder$HuffmanCodes.read(HuffmanDecoder.java:307) > at > org.apache.commons.compress.compressors.deflate64.HuffmanDecoder.decode(HuffmanDecoder.java:152) > at > org.apache.commons.compress.compressors.deflate64.Deflate64CompressorInputStream.read(Deflate64CompressorInputStream.java:84) > at > org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.read(ZipArchiveInputStream.java:493) > at java.base/java.io.InputStream.readNBytes(InputStream.java:396) at > java.base/java.io.InputStream.readAllBytes(InputStream.java:333) at > kotlinx.fuzzer.tests.apache.zip.ApacheZipTestKt.main(ApacheZipTest.kt:86) at > kotlinx.fuzzer.tests.apache.zip.ApacheZipTestKt.main(ApacheZipTest.kt) > {code:java} > import org.apache.commons.compress.archivers.ArchiveStreamFactory > import java.io.ByteArrayInputStream > import java.io.File > fun main() { > val bytes = File("ArrayIndexOutOfBoundsException1.zip").readBytes() > val input = ByteArrayInputStream(bytes) > ArchiveStreamFactory().createArchiveInputStream("zip", input).use { ais -> > ais.nextEntry > ais.readAllBytes() > } > } > {code} > Expected some other exception as IOException is the only declared. > > This Kotlin code fails with exception(ArrayIndexOutOfBoundsException2.zip is > in the attachments) > Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index -1 > out of bounds for length 8192Exception in thread "main" > java.lang.ArrayIndexOutOfBoundsException: Index -1 out of bounds for length > 8192 at > org.apache.commons.compress.compressors.lzw.LZWInputStream.expandCodeToOutputStack(LZWInputStream.java:232) > at > org.apache.commons.compress.archivers.zip.UnshrinkingInputStream.decompressNextSymbol(UnshrinkingInputStream.java:124) > at > org.apache.commons.compress.compressors.lzw.LZWInputStream.read(LZWInputStream.java:80) > at > org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.read(ZipArchiveInputStream.java:493) > at java.base/java.io.InputStream.readNBytes(InputStream.java:396) at > java.base/java.io.InputStream.readAllBytes(InputStream.java:333) at > kotlinx.fuzzer.tests.apache.zip.ApacheZipTestKt.main(ApacheZipTest.kt:86) at > kotlinx.fuzzer.tests.apache.zip.ApacheZipTestKt.main(ApacheZipTest.kt) > {code:java} > import org.apache.commons.compress.archivers.ArchiveStreamFactory > import java.io.ByteArrayInputStream > import java.io.File > fun main() { > val bytes = File("ArrayIndexOutOfBoundsException2.zip").readBytes() > val input = ByteArrayInputStream(bytes) > ArchiveStreamFactory().createArchiveInputStream("zip", input).use { ais -> > ais.nextEntry > ais.readAllBytes() > } > } > {code} > Expected some other exception as IOException is the only declared. -- This message was sent by Atlassian Jira (v8.3.4#803005)