fix: correct swapped Value field types in ElfSymbol32 and ElfSymbol64#1408
Merged
max-charlamb merged 2 commits intomainfrom Mar 23, 2026
Merged
fix: correct swapped Value field types in ElfSymbol32 and ElfSymbol64#1408max-charlamb merged 2 commits intomainfrom
max-charlamb merged 2 commits intomainfrom
Conversation
Co-authored-by: max-charlamb <44248479+max-charlamb@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
max-charlamb
March 20, 2026 15:51
View session
Co-authored-by: max-charlamb <44248479+max-charlamb@users.noreply.github.com>
max-charlamb
approved these changes
Mar 20, 2026
leculver
approved these changes
Mar 20, 2026
Contributor
leculver
left a comment
There was a problem hiding this comment.
Just double checked the underlying sources, this fix is correct...but it's surprising that it's been wrong for this long and we haven't noticed. :(
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1407.
The
Valuefield types were accidentally swapped between the two ELF symbol structs:ElfSymbol32.Valuewasulong(8 bytes) — should beuint(4 bytes per ELF specElf32_Addr)ElfSymbol64.Valuewasuint(4 bytes) — should beulong(8 bytes per ELF specElf64_Addr)For 32-bit ELF, the over-sized
ulongValuefield was mergingst_valueandst_sizeinto a single 8-byte read, causingGetExportSymbolAddressto return addresses with the symbol'sst_sizevalue leaked into the upper bits (e.g. returning0x20EFCE9BA8instead of0xEFCE9BA8).Also added the missing
(long)cast inElfSymbolTable.GetSymbolfor the 64-bit path sinceValueis now correctlyulong.