Uploaded image for project: 'Commons Compress'
  1. Commons Compress
  2. COMPRESS-334

ArArchiveInputStream.getBSDLongName does increment offset

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.10
    • Fix Version/s: 1.11
    • Component/s: Archivers
    • Labels:
      None

      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).

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              jgustie Jeremy Gustie
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: