Skip to content

gh-162129: Validate ZIP member comment length - #162149

Open
1cbyc wants to merge 1 commit into
python:mainfrom
1cbyc:1cbyc/162129-validate-member-comment
Open

1cbyc wants to merge 1 commit into
python:mainfrom
1cbyc:1cbyc/162129-validate-member-comment

Conversation

@1cbyc

@1cbyc 1cbyc commented Nov 17, 2026 •

Copy link
Copy Markdown

Fixes #162129.

Reject ZIP member comments larger than the format's 65,535-byte field before member data is written. This prevents a late struct.error during close from leaving the archive without a central directory.

The regression covers the exact boundary, the rejected boundary-plus-one value, and confirms the archive remains readable after rejection.

Tests:

  • ./python -m test test_zipfile -m test_member_comment_too_long
  • ./python -m test test_zipfile
  • make patchcheck
  • git diff --cached --check

Co-authored-by: insisong emmanuelisaacnsisong@gmail.com

Co-authored-by: insisong <emmanuelisaacnsisong@gmail.com>
@python-cla-bot

python-cla-bot Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

CLA signed

@BHUVANSH855 BHUVANSH855 left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CLA check is failing, kindly sign it to get reviewed.

@1cbyc

1cbyc commented Nov 17, 2026

Copy link
Copy Markdown
Author

CLA check is failing, kindly sign it to get reviewed.

i already signed it, what is wrong?

@BHUVANSH855

BHUVANSH855 commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

CLA check is failing, kindly sign it to get reviewed.

i already signed it, what is wrong?

huh, you signed it now after the comment is posted by me, not signed earlier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

zipfile: ZipInfo.comment exceeding 65535 bytes causes struct.error in ZipFile.close() without proper validation

2 participants