Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
1.20
-
None
-
None
Description
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)
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() } }
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)
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() } }
Expected some other exception as IOException is the only declared.