loader: validate ELF and SELF file bounds #348
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
GPU
GUI
help wanted
question
Shaders
Video
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/KytyPS5--KytyPS5!348
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/348/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@Techx3 on GitHub · 2026-08-28 19:47 UTC · original
Techx3:techx3/elf-self-bounds→main· +568 −15 · 6 files · 1 commits · closed without mergingSummary
Elf64allocates or reads loader tablesLoadSegmentindexes themSafety and compatibility details
The validator runs before the existing loader reads the image. It checks only invariants that the current
Elf64implementation already relies on:Zero-length segments and empty tables may retain otherwise unused offsets, avoiding over-validation. The validator does not authenticate, decrypt, or claim general SELF format support.
The local SDK 12 corpus has no ELF/SELF container documentation matching these fields, so this PR deliberately makes no SDK-derived metadata or format claims. The SDK-version extraction present in the experimental KytyTouche implementation was omitted.
Relationship to #302
PR #302 improves named boot-header failures. This PR covers deeper table, payload, arithmetic-overflow, and SELF-reference bounds that #302 does not validate. Both touch
elf.cpp, so a small rebase conflict is expected if #302 merges first; the functionality is complementary.Validation
elf_validator_testsRelease build: passedelf_validator_tests.exe: passedctest --test-dir _Build/launcher-usability -C Release -R "^elf_validator$" --output-on-failure: 1/1 passedkyty_emulatorRelease build with clang-cl: passedTests cover raw ELF, real file I/O, truncated and overflowing tables, out-of-range and zero-length segments, section payloads,
SHT_NOBITS, empty tables, supported and unsupported SELF headers, declared size, invalid program-header references, compression, size mismatches, and overflowing ranges.Provenance
This isolates and substantially hardens the ELF validator introduced in KytyTouche commit
9b5f2cd. Original authorship is retained through the commit co-author trailer.Pull request closed