Uploaded image for project: 'Commons Compress'
  1. Commons Compress
  2. COMPRESS-525

Decompression fails with IllegalStateException: Unsupported compression: 3

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.20
    • 1.21
    • None
    • None

    Description

      This Kotlin code fails with exception

      Exception in thread "main" java.lang.IllegalStateException: Unsupported compression: 3
      at org.apache.commons.compress.compressors.deflate64.HuffmanDecoder.decode(HuffmanDecoder.java:149)
      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:29)
      at ru.example.kotlinfuzzer.tests.MainKt.main(main.kt)

      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, 0x78, 0x00,
              0x61, 0x4a, 0x04, 0x04, 0x00, 0x00, 0xff, 0xff, 0x50, 0x53,
              0x07, 0x08, 0x43, 0xbe, 0xb7, 0xe8, 0x07, 0x00, 0x00, 0x00,
              0x01, 0x00, 0x00, 0x00, 0x50, 0x4b, 0x03, 0x04, 0x14, 0x00,
              0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
              0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
              0x01, 0x00, 0x00, 0x00, 0x62, 0x4a, 0x02, 0x04, 0x00, 0x00,
              0xff, 0xff, 0x50, 0x4b, 0x7f, 0x08, 0xf9, 0xef, 0xbe, 0x71,
              0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x50, 0x4b,
              0x03, 0x04, 0x14, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00,
              0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
              0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x63, 0x4a,
              0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x50, 0x4b, 0x07, 0x08,
              0x6f, 0xdf
          ).map { it.toByte() }.toByteArray()
      
          val input = ByteArrayInputStream(bytes)
          ArchiveStreamFactory().createArchiveInputStream("zip", input).use { ais ->
              ais.nextEntry
              ais.readAllBytes()
          }
      }
      

      IOException expected.

      Attachments

        Activity

          People

            Unassigned Unassigned
            zuevmaxim Maksim Zuev
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: