Skip to content

zlib: restart format detection when resetting Unzip - #66169

Open
marcopiraccini wants to merge 1 commit into
nodejs:mainfrom
marcopiraccini:zlib-unzip-reset
Open

marcopiraccini wants to merge 1 commit into
nodejs:mainfrom
marcopiraccini:zlib-unzip-reset

Conversation

@marcopiraccini

@marcopiraccini marcopiraccini commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

createUnzip().reset() left format detection state from the previous input. After a partial gzip header, the saved header-byte count was not cleared. After detecting gzip or zlib-wrapped deflate, the stream no longer used UNZIP
mode to detect the next input's format.

PR #64620 proposed a similar fix and was closed without merging. This patch tracks whether the stream was created as UNZIP and separates public reset from the internal gzip-member reset. It also tests resetting from detected gzip to deflate.

Fixes: #64619

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. zlib Issues and PRs related to the zlib module and its compression dependencies. labels Sep 21, 2026
@marcopiraccini
marcopiraccini marked this pull request as ready for review September 21, 2026 11:58
@codecov

codecov Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.35%. Comparing base (75e4bbe) to head (c1557aa).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #66169      +/-   ##
==========================================
- Coverage   90.36%   90.35%   -0.02%     
==========================================
  Files         792      792              
  Lines      275398   275409      +11     
  Branches    52776    52774       -2     
==========================================
- Hits       248877   248844      -33     
- Misses      16937    16988      +51     
+ Partials     9584     9577       -7     
Files with missing lines Coverage Δ
src/node_zlib.cc 80.37% <100.00%> (+0.16%) ⬆️

... and 31 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Signed-off-by: marcopiraccini <marco.piraccini@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. 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.

zlib: createUnzip().reset() does not restore auto-detection state

2 participants