Description
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:
int read = IOUtils.readFully(input, name);
count(read);
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:
int read = IOUtils.readFully(this, name);
(Sorry for posting code in the ticket, I will try and get an environment set up so I can start submitting patches).