Skip to content

Bug in LZMA compression #378

@ikrivosheev

Description

@ikrivosheev

Hello! Thank you for the library! I found a bug in the implementation of LZMA compression-decompression. I can't share archive were it reproduces. Anyway I found specification.

5.8.8 Storage fields for the property information within the LZMA 
    Properties Header are as follows:

         LZMA Version Information 2 bytes
         LZMA Properties Size 2 bytes
         LZMA Properties Data variable, defined by "LZMA Properties Size"

Link: https://pkwaredownloads.blob.core.windows.net/pem/APPNOTE.txt

We can see, first 2 bytes store LZMA version information.

Python implementation: https://github.com/python/cpython/blob/main/Lib/zipfile/__init__.py#L738
7-Zip implementation: https://github.com/mcmilk/7-Zip/blob/master/CPP/7zip/Archive/Zip/ZipHandler.cpp#L814
С++ implementation: https://bitbucket.org/wbenny/ziplib/src/176e4b6d51fc913fc7f7fb44df8f946374dc2c0c/Source/ZipLib/compression/lzma/lzma_decoder.h#lines-68

Link to source code:

  1. https://github.com/zip-rs/zip2/blob/master/src/compression.rs#L243
  2. https://github.com/zip-rs/zip2/blob/master/src/compression.rs#L310

Metadata

Metadata

Assignees

No one assigned

    Labels

    Amazon Q development agentGenerate new features or iterate code based on issue descriptions and comments.LZMAbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions