Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LZMA1 decompresser does not work after version 0.18.4 #634

Open
knuselme opened this issue Feb 10, 2025 · 1 comment
Open

LZMA1 decompresser does not work after version 0.18.4 #634

knuselme opened this issue Feb 10, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@knuselme
Copy link

knuselme commented Feb 10, 2025

Describe the bug

In my environment I get following error: Unexpected error occured during the unzipping/decryption of the file | decompress() takes exactly 1 argument (2 given)

Related issue

To Reproduce
The fail is hard using following:
with py7zr.SevenZipFile(bio, mode='r', password=get_archive_pw(dataprovider, archive_name)) as archive:
files = archive.readall()

Expected behavior

Environment (please complete the following information):

  • OS: Ubuntu 18.04.6 LTS
  • Python 3.9
  • py7zr version: All versions > 0.18.4

Test data(please attach in the report):

Additional context

The problem is introduced in version 0.18.5 with change of following in compresser.py:
Version 0.18.4:

def _decompress(self, data, max_length: int):
        for i, decompressor in enumerate(self.chain):
            if self._unpacked[i] < self._unpacksizes[i]:
                if isinstance(decompressor, LZMA1Decompressor) or isinstance(decompressor, PpmdDecompressor):
                    data = decompressor.decompress(data, max_length)  # always give max_length for lzma1
                else:
                    data = decompressor.decompress(data)
                self._unpacked[i] += len(data)
            elif len(data) == 0:
                data = b""
            else:
                raise EOFError
        return data

Version 0.18.5 and newer:

    def _decompress(self, data, max_length: int):
        for i, decompressor in enumerate(self.chain):
            if self._unpacked[i] < self._unpacksizes[i]:
                data = decompressor.decompress(data, max_length)
                self._unpacked[i] += len(data)
            elif len(data) == 0:
                data = b""
            else:
                raise EOFError
        return data

I have tested version 0.22.0 introducing the " data = decompressor.decompress(data)" and this works fine. But I would prefer an offical fix, rather than this personal hack.

@miurahr miurahr added the bug Something isn't working label Feb 23, 2025
@miurahr
Copy link
Owner

miurahr commented Feb 23, 2025

Strangely, all test cases with LZMA1 were passed. Could you provide test data without secrets or security issues?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants