Maksim Zuev created COMPRESS-528:
------------------------------------

             Summary: Tar decompression - Inconsistent entry size
                 Key: COMPRESS-528
                 URL: https://issues.apache.org/jira/browse/COMPRESS-528
             Project: Commons Compress
          Issue Type: Bug
    Affects Versions: 1.20
            Reporter: Maksim Zuev
         Attachments: InconsistentSize.tar

Expected that 
{{[getSize|https://commons.apache.org/proper/commons-compress/javadocs/api-1.20/org/apache/commons/compress/archivers/tar/TarArchiveEntry.html#getSize--]()
 }}returns the size of byte array read from ArchiveInputStream

To reproduce run this Kotlin code(InconsistentSize.tar is in the attachment). 
It fails with exception

Exception in thread "main" java.lang.IllegalStateException: 19 expected but 0 
found
 at ru.example.kotlinfuzzer.tests.MainKt.main(main.kt:82)
 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("InconsistentSize.tar")
    ArchiveStreamFactory().createArchiveInputStream("tar", 
tar.inputStream()).use { ais ->
        val expected = ais.nextEntry.size
        val actual = ais.readAllBytes().size.toLong()
        check(expected == actual) { "$expected expected but $actual found" }
    }
}
{code}
{{}}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to