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

Signed-off-by: marcopiraccini <marco.piraccini@gmail.com>
@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.31%. Comparing base (ea08334) to head (389d0f6).
⚠️ Report is 13 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #66169      +/-   ##
==========================================
- Coverage   92.75%   90.31%   -2.44%     
==========================================
  Files         421      790     +369     
  Lines      190606   272053   +81447     
  Branches    29206    51945   +22739     
==========================================
+ Hits       176790   245701   +68911     
- Misses      13488    16878    +3390     
- Partials      328     9474    +9146     
Files with missing lines Coverage Δ
src/node_zlib.cc 79.95% <100.00%> (ø)

... and 501 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.

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