[ 
https://issues.apache.org/jira/browse/COMPRESS-522?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Stefan Bodewig resolved COMPRESS-522.
-------------------------------------
    Resolution: Fixed

fixed with commit aa1bc872

> Decompression fails with IllegalStateException(Illegal LEN / NLEN values)
> -------------------------------------------------------------------------
>
>                 Key: COMPRESS-522
>                 URL: https://issues.apache.org/jira/browse/COMPRESS-522
>             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.IllegalStateException: Illegal LEN / 
> NLEN values
>  at 
> org.apache.commons.compress.compressors.deflate64.HuffmanDecoder.switchToUncompressedState(HuffmanDecoder.java:174)
>  at 
> org.apache.commons.compress.compressors.deflate64.HuffmanDecoder.decode(HuffmanDecoder.java:139)
>  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 ru.example.kotlinfuzzer.tests.MainKt.main(main.kt:17)
>  at ru.example.kotlinfuzzer.tests.MainKt.main(main.kt)
> {code:java}
> import org.apache.commons.compress.archivers.ArchiveStreamFactory
> import java.io.ByteArrayInputStream
> fun main() {
>     val bytes = listOf(
>         0x50, 0x4b, 0x03, 0x04, 0x14, 0x00, 0x08, 0x00, 0x09, 0x00,
>         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
>         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
>         0x61, 0x4a, 0x84, 0x02, 0x40, 0x00, 0x01, 0x00, 0xff, 0xff
>     ).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)

Reply via email to