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

IOUtils.readRange() can read more from a channel than asked for

    XMLWordPrintableJSON

    Details

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

      Description

      When IOUtils.readRange(ReadableByteChannel,int) gets less than the number of bytes asked for in the first read call it does not reduce the buffer size for the next read call and may read more than asked for.

      This situation is rare when using a FileChannel but I wrote a SeekableByteChannel backed by a URI using HTTP range requests and reading from a socket can often return less bytes than asked for. When I used this channel to read a ZipFile it only read the ZIP central directory partially sometimes because IOUtils.readRange() called from ZipFile.readCentralDirectoryEntry() read more bytes than asked for and it stopped parsing directory entries.

      Fix: https://github.com/apache/commons-compress/pull/214

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                peterlee Peter Lee
                Reporter:
                matthijsln Matthijs Laan
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 5h 10m
                  5h 10m