Skip to content

Refactor match and end variables in inftrees.c#72

Merged
bbuhrow merged 1 commit intobbuhrow:masterfrom
Mrcopytuo:fix-inftree
Dec 16, 2025
Merged

Refactor match and end variables in inftrees.c#72
bbuhrow merged 1 commit intobbuhrow:masterfrom
Mrcopytuo:fix-inftree

Conversation

@Mrcopytuo
Copy link
Copy Markdown
Contributor

Description

This PR applies the same fix as
madler/zlib@6a04314

The change removes the offset pointer optimization in inftrees.c and replaces it with a C-standard-compliant implementation.

The previous implementation relied on pointer arithmetic that subtracts an offset from a pointer and then indexes from that location. While this worked in practice, it can result in undefined behavior according to the C standard.


Changes

  • Removed offset-based pointer arithmetic in inftrees.c
  • Reworked index calculations to avoid undefined pointer behavior
  • Preserved the original logic and behavior while improving safety and portability

Reference

Upstream commit for comparison:
madler/zlib@6a04314

@bbuhrow bbuhrow merged commit 41910a8 into bbuhrow:master Dec 16, 2025
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.

2 participants