Skip to content

Fix gzip FEXTRA XLEN overflow - #1428

Merged
adamhathcock merged 2 commits into
adamhathcock:releasefrom
syrok0010:fix/gzip-extra-field-length
Oct 9, 2026
Merged

adamhathcock merged 2 commits into
adamhathcock:releasefrom
syrok0010:fix/gzip-extra-field-length

Conversation

@syrok0010

Copy link
Copy Markdown

Gzip's FEXTRA length (XLEN) is an unsigned 16-bit value. Casting it to short turns valid lengths of 32768–65535 into negative values, causing an OverflowException when allocating the extra-field buffer in both synchronous and asynchronous decompression.

Keep the decoded length as an int in both paths so the full XLEN range is handled correctly. This is a minimal fix that preserves existing behavior for smaller extra fields and leaves public APIs unchanged.

Regression tests verify the decompressed payload for XLEN values of 32767, 32768, and 65535 in both paths. The asynchronous test uses an async-only input stream to ensure it exercises asynchronous reading.

Validation:

  • All 59 GZip tests pass on .NET 10 and .NET Framework 4.8.
  • CSharpier check passes.

Please consider backporting this fix to the 0.50.x release line: the same signed XLEN handling is present in 0.50.4.

Copilot AI balanced review requested due to automatic review settings October 6, 2026 11:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@syrok0010
syrok0010 requested a balanced review from Copilot October 6, 2026 19:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI balanced review requested due to automatic review settings October 8, 2026 12:00

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@adamhathcock

Copy link
Copy Markdown
Owner

Gonna review this but I'd like this targeting the release branch

Copilot AI balanced review requested due to automatic review settings October 8, 2026 17:23
@syrok0010
syrok0010 force-pushed the fix/gzip-extra-field-length branch from 221f49b to 6c13a99 Compare October 8, 2026 17:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@syrok0010
syrok0010 changed the base branch from master to release October 8, 2026 17:24
@adamhathcock

Copy link
Copy Markdown
Owner

Thanks for this!

@adamhathcock
adamhathcock merged commit 1b7a1fa into adamhathcock:release Oct 9, 2026
3 checks passed
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.

3 participants