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

Fix decoding of 7z files containing LZMA streams with end marker

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.21
    • 1.22
    • Archivers
    • None
    • Patch

    Description

      Some uncommon but valid .7z files contain LZMA streams that use the end of stream marker. Currently Commons Compress together with XZ for Java considers such files to be corrupt.

      XZ for Java 1.9 added a new method LZMAInputStream.enableRelaxedEndCondition() specifically for this issue. To use this feature in Commons Compress, a change is needed to the "decode" function in src/main/java/org/apache/commons/compress/archivers/sevenz/LZMADecoder.java:

      - return new LZMAInputStream(in, uncompressedLength, propsByte, dictSize);
      + final LZMAInputStream lzmaIn = new LZMAInputStream(in, uncompressedLength, propsByte, dictSize);
      + lzmaIn.enableRelaxedEndCondition();
      + return lzmaIn;

      A tiny test file is attached (thanks to Simon for providing it). Another test file "sheet.7z" can be found from <https://sourceforge.net/p/lzmautils/discussion/708858/thread/822d80d5ea/>.

      XZ for Java 1.9 is already a few months old, so I apologize for not reporting this earlier.

      Attachments

        1. lzma-with-eos.7z
          0.2 kB
          Lasse Collin

        Issue Links

          Activity

            People

              Unassigned Unassigned
              larhzu Lasse Collin
              Votes:
              0 Vote for this issue
              Watchers:
              2 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 - 1h 10m
                  1h 10m