Skip to content

Reject overflowing ELF section ranges - #19393

Merged
elad335 merged 1 commit into
RPCS3:masterfrom
acts-1631:elf-section-range-fix
Sep 3, 2026
Merged

Reject overflowing ELF section ranges#19393
elad335 merged 1 commit into
RPCS3:masterfrom
acts-1631:elf-section-range-fix

Conversation

@acts-1631

Copy link
Copy Markdown
Contributor

When RPCS3 loads an ELF, elf::load tries to reuse data already read for each loadable section by creating bin_view into the matching program-header buffer. The range check adds attacker-controlled section offsets and sizes to segment bounds, so integer wraparound can make an invalid section appear to fit. Callers such as ppu_load_rel_exec later copy that view into emulated memory, causing a host out-of-bounds read for a malformed ELF.

Replace the checks in both the load and save paths with subtraction-based bounds checks. These verify that the section size fits in the segment and that its offset remains within the available segment bytes without overflowing.

@AniLeo
AniLeo requested a review from Megamouse September 3, 2026 13:14
@elad335
elad335 merged commit 0a85b39 into RPCS3:master Sep 3, 2026
10 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.

2 participants