Skip to content

Conversation

austinderek
Copy link

When using the -d flag, set the exit code to 1 if there is a diff.

Fixes golang#46289


🔄 This is a mirror of upstream PR golang#75649

callthingsoff and others added 2 commits September 28, 2025 21:38
When applying relocations, a malformed ELF file can provide an offset
that, when added to the relocation size, overflows. This wrapped-around
value could then incorrectly pass the bounds check, leading to a panic
when the slice is accessed with the original large offset.

This change eliminates the manual bounds and overflow checks
and writes a relocation to slice by calling putUint.

The putUint helper function centralizes the logic for validating slice
access, correctly handling both out-of-bounds and integer overflow conditions.
This simplifies the relocation code and improves robustness when parsing
malformed ELF files.

Fixes golang#75516

Change-Id: I00d806bf5501a9bf70200585ba4fd0475d7b2ddc
GitHub-Last-Rev: 4914431
GitHub-Pull-Request: golang#75522
Reviewed-on: https://go-review.googlesource.com/c/go/+/705075
Reviewed-by: Florian Lehner <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
Reviewed-by: Junyang Shao <[email protected]>
Auto-Submit: Ian Lance Taylor <[email protected]>
Reviewed-by: Michael Knyszek <[email protected]>
Reviewed-by: Ian Lance Taylor <[email protected]>
Commit-Queue: Ian Lance Taylor <[email protected]>
When using the -d flag, set the exit code to 1 if there is a diff.

Fixes golang#46289
@austinderek austinderek force-pushed the master branch 28 times, most recently from d17a28a to fc88e18 Compare September 29, 2025 22:01
@austinderek austinderek force-pushed the master branch 30 times, most recently from 4c0fd3a to 5bf50a0 Compare October 7, 2025 10:02
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