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

Decompression fails with ClassCastException

    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.ClassCastException: class org.apache.commons.compress.archivers.zip.UnrecognizedExtraField cannot be cast to class org.apache.commons.compress.archivers.zip.Zip64ExtendedInformationExtraField (org.apache.commons.compress.archivers.zip.UnrecognizedExtraField and org.apache.commons.compress.archivers.zip.Zip64ExtendedInformationExtraField are in unnamed module of loader 'app')
      at org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.processZip64Extra(ZipArchiveInputStream.java:419)
      at org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.getNextZipEntry(ZipArchiveInputStream.java:347)
      at org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.getNextEntry(ZipArchiveInputStream.java:435)
      at ru.example.kotlinfuzzer.tests.CompressTestKt.main(CompressTest.kt:88)
      at ru.example.kotlinfuzzer.tests.CompressTestKt.main(CompressTest.kt)

      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, 0x01, 0x00, 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
          ).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: