Skip to content

🐛 Stop a malformed zip64 record bypassing the error event - #2

Closed
alecgibson wants to merge 1 commit into
masterfrom
fix-112-zip64-uncaught-error
Closed

alecgibson wants to merge 1 commit into
masterfrom
fix-112-zip64-uncaught-error

Conversation

@alecgibson

Copy link
Copy Markdown
Owner

Fixes antelle#112

At the moment, a crafted archive can make the central-directory reader throw synchronously from inside an fs.read callback, which surfaces as an uncaughtException rather than an error event. A caller with correct error handling still has its process taken down by a malformed file.

op.complete is assigned three completion handlers, and only one of them — readCentralDirectoryComplete — guards itself. Since all three are reached through the single op.complete() call in readUntilFoundCallback, guarding that one statement covers every path, and any handler added later. That leaves the try/catch in readCentralDirectoryComplete redundant, but removing it would mean re-indenting the whole function, so it stays.

🤖 Generated with Claude Code

Co-Authored-By: Claude noreply@anthropic.com

Fixes antelle#112

At the moment, a crafted archive can make the central-directory reader
throw synchronously from inside an `fs.read` callback, which surfaces as
an `uncaughtException` rather than an `error` event. A caller with
correct error handling still has its process taken down by a malformed
file.

`op.complete` is assigned three completion handlers, and only one of
them — `readCentralDirectoryComplete` — guards itself. Since all three
are reached through the single `op.complete()` call in
`readUntilFoundCallback`, guarding that one statement covers every path,
and any handler added later. That leaves the try/catch in
`readCentralDirectoryComplete` redundant, but removing it would mean
re-indenting the whole function, so it stays.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@alecgibson

Copy link
Copy Markdown
Owner Author

Opened against the wrong base repo; superseded by antelle#114.

@alecgibson alecgibson closed this Sep 15, 2026
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.

Malformed ZIP64 record throws out of an fs.read callback, bypassing the 'error' event

1 participant