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

Tar decompression fails with NegativeArraySizeException

    XMLWordPrintableJSON

Details

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

    Description

      This Kotlin code fails with exception(NegativeArraySizeException.tar is in the attachment)

      Exception in thread "main" java.lang.NegativeArraySizeException: -5332783
      at org.apache.commons.compress.archivers.tar.TarArchiveInputStream.parsePaxHeaders(TarArchiveInputStream.java:703)
      at org.apache.commons.compress.archivers.tar.TarArchiveInputStream.paxHeaders(TarArchiveInputStream.java:555)
      at org.apache.commons.compress.archivers.tar.TarArchiveInputStream.getNextTarEntry(TarArchiveInputStream.java:404)
      at org.apache.commons.compress.archivers.tar.TarArchiveInputStream.getNextEntry(TarArchiveInputStream.java:799)
      at ru.example.kotlinfuzzer.tests.MainKt.main(main.kt:31)
      at ru.example.kotlinfuzzer.tests.MainKt.main(main.kt)

      import org.apache.commons.compress.archivers.ArchiveStreamFactory
      import java.io.File
      
      fun main() {
          val tar = File("NegativeArraySizeException.tar")
          ArchiveStreamFactory().createArchiveInputStream("tar", tar.inputStream()).use { ais ->
              ais.nextEntry
              ais.readAllBytes()
          }
      }
      

      IOException expected

      Attachments

        1. NegativeArraySizeException.tar
          0.5 kB
          Maksim Zuev

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: