Skip to content

Code cannot handle Error which are presented as "There are some data after the end of the payload data" in 7zip #536

Open
@Mrw33554432

Description

@Mrw33554432

Describe the bug

For some old files that may contains error as described in the title, this package fail to work and runs the process forever (dead loop).

Related issue

To Reproduce
contact me and I will send the files to you, so you can have a try yourself.
Code fragment

    if archive_type == '7z':
        for member in archive.getnames():
            original_filename = member
            corrected_filename = guess_encoding(original_filename)
            try:
                extracted_path = os.path.join(extract_to, corrected_filename)
                if not os.path.exists(extracted_path):
                    archive.extract(targets=[member], path=extract_to)
                    logging.info(f"Extracted {corrected_filename} to {extract_to}")
                    # Check nested archive
                    recursive_extraction_check(extracted_path, extract_to)
            except Exception as e:  # Consider refining exception handling
                logging.error(f"Failed to extract {corrected_filename}: {e}")

Expected behavior
Report the error and exit

Environment (please complete the following information):

  • OS: Windows 10
  • Python 3.11
  • py7zr version: 0.20.5

Test data(please attach in the report):
Too large to upload

Additional context
I will try to fix it

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions