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

7z random access fails on shuffled entry list

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.20
    • 1.21
    • None
    • None

    Description

      I noticed a problem on a 7z file and could reproduce the error if the InputStream is retrieved after shuffling the entries.

      This test fails with a checksum verification error

      @Test
      public void retrieveInputStreamForShuffledEntries() throws IOException {
          try (final SevenZFile sevenZFile = new SevenZFile(getFile("COMPRESS-256.7z"))) {
              List<SevenZArchiveEntry> entries = (List<SevenZArchiveEntry>) sevenZFile.getEntries();
              Collections.shuffle(entries);
              for (final SevenZArchiveEntry entry : entries) {
                  IOUtils.toByteArray(sevenZFile.getInputStream(entry));
              }
          }
      }
      

      This is the exception

      java.io.IOException: Checksum verification failed
      	at org.apache.commons.compress.utils.ChecksumVerifyingInputStream.read(ChecksumVerifyingInputStream.java:94)
      	at org.apache.commons.compress.utils.ChecksumVerifyingInputStream.read(ChecksumVerifyingInputStream.java:74)
      	at org.apache.commons.compress.utils.IOUtils.copy(IOUtils.java:87)
      	at org.apache.commons.compress.utils.IOUtils.copy(IOUtils.java:62)
      	at org.apache.commons.compress.utils.IOUtils.toByteArray(IOUtils.java:247)
      	at org.apache.commons.compress.archivers.sevenz.SevenZFileTest.retrieveInputStreamForShuffledEntries(SevenZFileTest.java:616)
      

      This also fails on the current master with the same error

      Attachments

        Activity

          People

            peterlee Peter Lee
            rschimpf Robin Schimpf
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: