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

Madhu Gopanna updated COMPRESS-608:
-----------------------------------
    Description: 
 

 

  was:
This Kotlin code fails with exception(NumberFormatException.tar is in the 
attachment)

Exception in thread "main" java.lang.NumberFormatException: For input string: 
"143266�921.098285006"
 at 
java.base/jdk.internal.math.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:2054)
 at 
java.base/jdk.internal.math.FloatingDecimal.parseDouble(FloatingDecimal.java:110)
 at java.base/java.lang.Double.parseDouble(Double.java:543)
 at 
org.apache.commons.compress.archivers.tar.TarArchiveEntry.processPaxHeader(TarArchiveEntry.java:1161)
 at 
org.apache.commons.compress.archivers.tar.TarArchiveEntry.updateEntryFromPaxHeaders(TarArchiveEntry.java:1093)
 at 
org.apache.commons.compress.archivers.tar.TarArchiveInputStream.applyPaxHeadersToCurrentEntry(TarArchiveInputStream.java:757)
 at 
org.apache.commons.compress.archivers.tar.TarArchiveInputStream.paxHeaders(TarArchiveInputStream.java:562)
 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:69)
 at ru.example.kotlinfuzzer.tests.MainKt.main(main.kt)
{code:java}
import org.apache.commons.compress.archivers.ArchiveStreamFactory
import java.io.File

fun main() {
    val tar = File("NumberFormatException.tar")
    ArchiveStreamFactory().createArchiveInputStream("tar", 
tar.inputStream()).use { ais ->
        ais.nextEntry
        ais.readAllBytes()
    }
}
{code}
This Kotlin code fails with exception(LongName.tar is in the attachment)

Exception in thread "main" java.lang.RuntimeException: file name 'asidhuasih a
 sdjn osdn 
 sdvs ndv
 asdjbhasdb asb iasbfi basdigf basduio 
 asdkhasjdhasd
 asdjkhasnjddjasjdas
 /?' is too long ( > 100 bytes)
 at 
org.apache.commons.compress.archivers.tar.TarArchiveOutputStream.handleLongName(TarArchiveOutputStream.java:683)
 at 
org.apache.commons.compress.archivers.tar.TarArchiveOutputStream.putArchiveEntry(TarArchiveOutputStream.java:358)
 at ru.example.kotlinfuzzer.tests.MainKt.test(main.kt:20)
 at ru.example.kotlinfuzzer.tests.MainKt.main(main.kt:8)
 at ru.example.kotlinfuzzer.tests.MainKt.main(main.kt)
{code:java}
import org.apache.commons.compress.archivers.ArchiveStreamFactory
import org.apache.commons.compress.archivers.tar.TarArchiveEntry
import java.io.File

fun main() {
    test(File("LongName.tar"))
}

fun test(tar: File) {
    val (decompressed, name) = 
ArchiveStreamFactory().createArchiveInputStream("tar", tar.inputStream()).use { 
ais ->
        val entry = ais.nextEntry
        ais.readAllBytes() to entry.name
    }
    File.createTempFile("apache_", ".tar").also {
        ArchiveStreamFactory().createArchiveOutputStream("tar", 
it.outputStream()).use { aos ->
            val entry = TarArchiveEntry(name)
            entry.size = decompressed.size.toLong()
            aos.putArchiveEntry(entry)
            try {
                aos.write(decompressed)
            } finally {
                aos.closeArchiveEntry()
            }
        }
    }
}
{code}
 

IOException expected


> Corrupt Tar decompression fails to find all available entries
> -------------------------------------------------------------
>
>                 Key: COMPRESS-608
>                 URL: https://issues.apache.org/jira/browse/COMPRESS-608
>             Project: Commons Compress
>          Issue Type: Bug
>    Affects Versions: 1.21
>            Reporter: Madhu Gopanna
>            Priority: Major
>
>  
>  



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to