Skip to content

Reject entries whose offset is past the end of the archive - #120

Open
DicksonWu654 wants to merge 1 commit into
antelle:masterfrom
DicksonWu654:zip64-entry-offset
Open

DicksonWu654 wants to merge 1 commit into
antelle:masterfrom
DicksonWu654:zip64-entry-offset

Conversation

@DicksonWu654

Copy link
Copy Markdown

A ZIP64 extra field can give an entry a local header offset of 2^53 or more. openEntry passes it to fs.read as the position, Node throws ERR_OUT_OF_RANGE synchronously, and when stream() or extract() from the callback API runs outside the ready handler nothing catches it, so the process exits. A 133-byte archive is enough.

This checks the offset against the file size before the read and returns an Invalid entry offset error instead. With it the crafted archive gets that error through both calls and valid archives still stream and extract. npm test passes (385 assertions) and eslint is clean.

Also adds a line to the disclosure credits in the README, as discussed by email.

A ZIP64 extra field can give an entry a local header offset of 2^53 or
more. openEntry passed it straight to fs.read, which throws
ERR_OUT_OF_RANGE synchronously; with the callback API used outside the
ready handler nothing caught it and the process exited. Check the
offset against the file size first and return an error instead.

Signed-off-by: Dickson Wu <dickson.wu@certik.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-26T19:14:16.365727Z 54ccff1 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant