commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stefan Bodewig (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (COMPRESS-334) ArArchiveInputStream.getBSDLongName does increment offset
Date Fri, 05 Feb 2016 19:44:39 GMT

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

Stefan Bodewig resolved COMPRESS-334.
-------------------------------------
       Resolution: Fixed
    Fix Version/s: 1.11

Thanks a lot for the analysis, you are correct of course.

git commit 9431b16 contains your second alternative.

> ArArchiveInputStream.getBSDLongName does increment offset
> ---------------------------------------------------------
>
>                 Key: COMPRESS-334
>                 URL: https://issues.apache.org/jira/browse/COMPRESS-334
>             Project: Commons Compress
>          Issue Type: Bug
>          Components: Archivers
>    Affects Versions: 1.10
>            Reporter: Jeremy Gustie
>             Fix For: 1.11
>
>
> I have an AR archive which uses the BSD long name convention and I cannot read past the
first entry without failing.
> I dug into the issue and it appears the problem is with {{getBSDLongName}} which calls
{{readFully}} with the underlying stream:
> {code}
> int read = IOUtils.readFully(input, name);
> count(read);
> {code}
> This does not increment the {{offset}} which is later used by {{read(byte[], int, int)}}
to compute the value of {{toRead}}. Since {{offset}} is too small, {{toRead}} ends up too
big and the first entry contents end up pulling in the first {{n}} bytes of the next entry
header ({{n}} is the BSD long name length).
> I think this can be addressed by adding {{offset += read}} or changing the above code
to just:
> {code}
> int read = IOUtils.readFully(this, name);
> {code}
> (Sorry for posting code in the ticket, I will try and get an environment set up so I
can start submitting patches).



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

Mime
View raw message