Skip to content

[release/8.0-staging] Fix return in zlib-intel when window allocation fails #116550

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 13, 2025

Conversation

ericstj
Copy link
Member

@ericstj ericstj commented Jun 11, 2025

Customer Impact

  • Customer reported
  • Found internally

If a process is running low on memory and fails window allocation in zlib on Windows, we weren't correctly returning the error to produce the correct ZlibException. This creates a reliability issue as the failure looks like an application crash instead of out of memory. This issue is unique to the zlib-intel codebase.

Regression

  • Yes
  • No

Testing

Unit tests, adhoc testing.

Risk

Low. This is likely a non-recoverable error, we're just making sure we surface in a way that diagnostics will correctly capture.

@ericstj ericstj changed the title Fix return in zlib-intel when window allocation fails [release/8.0-staging] Fix return in zlib-intel when window allocation fails Jun 11, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR addresses a reliability issue by ensuring inflate.c returns Z_MEM_ERROR immediately when window allocation fails, allowing the proper exception to surface instead of leading to a crash.

  • Converted deferred ret = Z_MEM_ERROR assignments to immediate return Z_MEM_ERROR in two error paths.
  • Ensures out-of-memory conditions produce the correct error response in zlib-intel on Windows.
Comments suppressed due to low confidence (2)

src/native/external/zlib-intel/inflate.c:254

  • Add or update unit tests to simulate window allocation failures and verify that Z_MEM_ERROR is returned and a ZlibException is thrown as expected.
return Z_MEM_ERROR;

src/native/external/zlib-intel/inflate.c:730

  • Ensure tests cover this second allocation failure path to confirm consistent error handling in both branches.
return Z_MEM_ERROR;

@ericstj ericstj added Servicing-consider Issue for next servicing release review area-System.IO.Compression labels Jun 11, 2025
Copy link
Contributor

Tagging subscribers to this area: @dotnet/area-system-io-compression
See info in area-owners.md if you want to be subscribed.

@ericstj ericstj added Servicing-approved Approved for servicing release and removed Servicing-consider Issue for next servicing release review labels Jun 11, 2025
@ericstj ericstj enabled auto-merge (squash) June 12, 2025 15:40
@ericstj ericstj merged commit 3f7b7f6 into dotnet:release/8.0-staging Jun 13, 2025
183 of 190 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Jul 13, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants