Skip to content

zlib: avoid mutable push in sync output collection - #67748

Open
rozzilla wants to merge 1 commit into
nodejs:mainfrom
rozzilla:zlib-sync-output-no-push
Open

rozzilla wants to merge 1 commit into
nodejs:mainfrom
rozzilla:zlib-sync-output-no-push

Conversation

@rozzilla

@rozzilla rozzilla commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

This follows the suggestion in #67456 (comment) to protect code that intentionally doesn't use primordials (node:zlib is listed in doc/contributing/primordials.md) by replacing user-mutable .push() with indexed assignments.
The new test covers both paths.

processChunkSync() and processSyncWithDefaults() collected output
chunks with buffers.push(), which looks up Array.prototype.push at call
time. Replacing that method from user code changed how synchronous zlib
calls such as gunzipSync() collected their output. Use indexed
assignments instead.

Signed-off-by: Roberto Bianchi <roberto.bianchi@spendesk.com>
@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. zlib Issues and PRs related to the zlib module and its compression dependencies. labels Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ci PRs that need a full CI run. zlib Issues and PRs related to the zlib module and its compression dependencies.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants