[ https://issues.apache.org/jira/browse/COMPRESS-516?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17114870#comment-17114870 ]
Stefan Bodewig commented on COMPRESS-516: ----------------------------------------- Thanks, this is very similar to COMPRESS-424 and back then I only looked for indexed access to the internal arrays and overlooked the {{fill}} case. > Decompression fails with ArrayIndexOutOfBoundsException > ------------------------------------------------------- > > Key: COMPRESS-516 > URL: https://issues.apache.org/jira/browse/COMPRESS-516 > Project: Commons Compress > Issue Type: Bug > Affects Versions: 1.20 > Reporter: Maksim Zuev > Priority: Major > Fix For: 1.21 > > > This Kotlin code fails with exception > Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Array > index out of range: 16777295 > at java.base/java.util.Arrays.rangeCheck(Arrays.java:123) > at java.base/java.util.Arrays.fill(Arrays.java:3516) > at > org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream.getAndMoveToFrontDecode(BZip2CompressorInputStream.java:670) > at > org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream.initBlock(BZip2CompressorInputStream.java:332) > at > org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream.<init>(BZip2CompressorInputStream.java:136) > at > org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream.<init>(BZip2CompressorInputStream.java:113) > at > org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.getNextZipEntry(ZipArchiveInputStream.java:368) > at > org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.getNextEntry(ZipArchiveInputStream.java:435) > at ru.example.kotlinfuzzer.tests.CompressTestKt.main(CompressTest.kt:97) > at ru.example.kotlinfuzzer.tests.CompressTestKt.main(CompressTest.kt) > > {code:java} > import org.apache.commons.compress.archivers.ArchiveStreamFactory > import java.io.ByteArrayInputStream > fun main() { > val bytes = listOf( > 0x50, 0x4b, 0x03, 0x04, 0x2e, 0x00, 0x00, 0x00, 0x0c, 0x00, > 0x84, 0xb6, 0xba, 0x46, 0x72, 0xb6, 0xfe, 0x77, 0x63, 0x00, > 0x00, 0x00, 0x6b, 0x00, 0x00, 0x00, 0x03, 0x00, 0x1c, 0x00, > 0x62, 0x62, 0x62, 0x55, 0x54, 0x09, 0x00, 0x03, 0xe7, 0xce, > 0x64, 0x55, 0xf3, 0xce, 0x64, 0x55, 0x75, 0x78, 0x0b, 0x00, > 0x01, 0x04, 0x5c, 0xf9, 0x01, 0x00, 0x04, 0x88, 0x13, 0x00, > 0x00, 0x42, 0x5a, 0x68, 0x34, 0x31, 0x41, 0x59, 0x26, 0x53, > 0x59, 0x62, 0xe4, 0x4f, 0x51, 0x00, 0x00, 0x0d, 0xd1, 0x80, > 0x00, 0x10, 0x40, 0x00, 0x35, 0xf9, 0x8b, 0x00, 0x20, 0x00, > 0x48, 0x89, 0xfa, 0x94, 0xf2, 0x9e, 0x29, 0xe8, 0xd2, 0x11, > 0x8a, 0x4f, 0x53, 0x34, 0x0f, 0x51, 0x7a, 0xed, 0x86, 0x65, > 0xd6, 0xed, 0x61, 0xee, 0x68, 0x89, 0x48, 0x7d, 0x07, 0x71, > 0x92, 0x2a, 0x50, 0x60, 0x04, 0x95, 0x61, 0x35, 0x47, 0x73, > 0x31, 0x29, 0xc2, 0xdd, 0x5e, 0xc7, 0x4a, 0x15, 0x14, 0x32, > 0x4c, 0xda, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00 > ).map { it.toByte() }.toByteArray() > val input = ByteArrayInputStream(bytes) > ArchiveStreamFactory().createArchiveInputStream("zip", input).use { ais -> > ais.nextEntry > ais.readAllBytes() > } > } > {code} > IOException expected. -- This message was sent by Atlassian Jira (v8.3.4#803005)