You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Jeremy Gustie (JIRA)" <ji...@apache.org> on 2016/02/04 21:24:40 UTC
[jira] [Created] (COMPRESS-334) ArArchiveInputStream.getBSDLongName
does increment offset
Jeremy Gustie created COMPRESS-334:
--------------------------------------
Summary: 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
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)