You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Maksim Zuev (Jira)" <ji...@apache.org> on 2020/08/25 22:01:00 UTC
[jira] [Created] (COMPRESS-553) Tar decompression fails with
StringIndexOutOfBoundsException
Maksim Zuev created COMPRESS-553:
------------------------------------
Summary: Tar decompression fails with StringIndexOutOfBoundsException
Key: COMPRESS-553
URL: https://issues.apache.org/jira/browse/COMPRESS-553
Project: Commons Compress
Issue Type: Bug
Affects Versions: 1.20, 1.21
Reporter: Maksim Zuev
Attachments: StringIndexOutOfBoundsException.tar
This Kotlin code fails with exception(StringIndexOutOfBoundsException is in the attachments)
Exception in thread "main" java.lang.StringIndexOutOfBoundsException: offset 0, count -1, length 0Exception in thread "main" java.lang.StringIndexOutOfBoundsException: offset 0, count -1, length 0 at java.base/java.lang.String.checkBoundsOffCount(String.java:3304) at java.base/java.lang.String.<init>(String.java:505) at org.apache.commons.compress.archivers.tar.TarArchiveInputStream.parsePaxHeaders(TarArchiveInputStream.java:766) at org.apache.commons.compress.archivers.tar.TarArchiveInputStream.paxHeaders(TarArchiveInputStream.java:605) at org.apache.commons.compress.archivers.tar.TarArchiveInputStream.getNextTarEntry(TarArchiveInputStream.java:425) at org.apache.commons.compress.archivers.tar.TarArchiveInputStream.getNextEntry(TarArchiveInputStream.java:858) at kotlinx.fuzzer.tests.apache.tar.ApacheTarTestKt.main(ApacheTarTest.kt:79) at kotlinx.fuzzer.tests.apache.tar.ApacheTarTestKt.main(ApacheTarTest.kt)
{code:java}
import org.apache.commons.compress.archivers.ArchiveStreamFactory
import org.apache.commons.compress.archivers.tar.TarArchiveEntry
import java.io.File
import java.io.FileInputStream
fun main() {
FileInputStream(File("StringIndexOutOfBoundsException.tar")).use { fis ->
ArchiveStreamFactory().createArchiveInputStream("tar", fis).use { ais ->
var zae = ais.nextEntry as TarArchiveEntry?
while (zae != null) {
ais.readAllBytes()
zae = ais.nextEntry as TarArchiveEntry?
}
}
}
}
{code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)