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

Buffer not read first time for entries with STORED compression method

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Duplicate
    • 1.7
    • 1.8
    • Archivers
      • Fedora 20 x64
      • Java 1.7.0_51 x64
      • archive created with Nautilus' context menu

    Description

      Trying to extract a ZIP archive that contains entries with STORED compression method, the ZipArchiveInputStream.readStored(byte[], int, int) method is called. At this point, because the buf array has not had a chance to be populated with values from the underlying input stream and because there's no condition to detect this, the resulting content is prefixed with the buffer's length (512) of 0 bytes.

      I've found that chancing:

      if (buf.position() >= buf.limit()) {

      with

      if (buf.position() >= buf.limit() || current.bytesReadFromStream == 0) {

      solves the issue.

      Attachments

        1. test.zip
          0.2 kB
          Radu Almășan

        Issue Links

          Activity

            People

              Unassigned Unassigned
              radu.almasan Radu Almășan
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: