commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dye357 (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (COMPRESS-330) Tar UnArchive Fails when archive contains directory sizes which are non-zero.
Date Tue, 19 Jan 2016 18:58:39 GMT

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

Dye357 updated COMPRESS-330:
----------------------------
    Description: 
Tar UnArchive Fails when archive contains directory sizes which are non-zero. I recently came
across a set of files which failed to extract with commons-compress but I was able to successfully
extract the files with GNU tar. 

The problem is TarArchiveInputStream.java gets the size of each entry in a tar archive to
determine how many bytes to read ahead. Directories are always sized 0 bytes, however its
technically possible a tar archive contains a size for a directory. This causes the Input
Stream to loose it's place and eventually results in an exception being thrown.

I was able to implement a proof-of-concept fix by checking if an entity is a directory and
setting the directory size to 0. (A directory with Files in a Tar Archive still has a size
of 0 as the directory itself does not have size in the archive.)

  was:
Tar UnArchive Fails when archive contains directory sizes which are non-zero. I recently came
across a set of files which failed to extract with commons-compress but I was able to successfully
extract the files with GNU tar. 

The problem is TarArchiveInputStream.java gets the size of each entry in a tar archive to
determine how many bytes to read ahead. Directories are always sized 0 bytes, however its
technically possible a tar archive contains a size for a directory. This causes the Input
Stream to loose it's place and eventually results in an exception being thrown.



> Tar UnArchive Fails when archive contains directory sizes which are non-zero.
> -----------------------------------------------------------------------------
>
>                 Key: COMPRESS-330
>                 URL: https://issues.apache.org/jira/browse/COMPRESS-330
>             Project: Commons Compress
>          Issue Type: Bug
>          Components: Archivers
>    Affects Versions: 1.10
>         Environment: Java 1.8
>            Reporter: Dye357
>            Priority: Minor
>
> Tar UnArchive Fails when archive contains directory sizes which are non-zero. I recently
came across a set of files which failed to extract with commons-compress but I was able to
successfully extract the files with GNU tar. 
> The problem is TarArchiveInputStream.java gets the size of each entry in a tar archive
to determine how many bytes to read ahead. Directories are always sized 0 bytes, however its
technically possible a tar archive contains a size for a directory. This causes the Input
Stream to loose it's place and eventually results in an exception being thrown.
> I was able to implement a proof-of-concept fix by checking if an entity is a directory
and setting the directory size to 0. (A directory with Files in a Tar Archive still has a
size of 0 as the directory itself does not have size in the archive.)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message