bug(relinker): large non-ELF inputs allocate the whole file before format validation #8685
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Imported from boykopovar/AnyPS5. Originally posted by Filip722 on 2026-10-20T21:01:41Z.
Trying to bring up God of War: Sons of Sparta (PPSA28997) from local
.pkgfiles exposed an input-validation problem: the CLI allocates a buffer for the entire input before checking its ELF header. A large unsupported input can therefore report onlyFAIL: std::bad_alloc, instead of explaining that a clean ELF executable is required.This report concerns early rejection and diagnostics, not adding package extraction or claiming a title runtime regression. No game code ran.
a6a4101e190ec408c3ed471d20f06872cae1b4a3(existing PR #8640 worktree).9d5099f5e76208ff39d2b3bd70c9d96223c5e353shows the same full-size allocation incore/relinker/io/src/FileReader.cppbefore the header checks incore/relinker/relinker/src/parsing/ElfReader.cpp. Current main was not rebuilt or executed.Reproduction without game data (Linux, Python 3; pass the relinker binary path as the first argument):
Observed:
The larger file is sparse; both inputs have the same invalid magic. The 512 MiB address-space cap is intentional and makes allocation failure deterministic without exhausting host memory. An uncapped out-of-memory failure was not tested.
--skip-sce-moduleis used only to isolate header validation in this reproduction, not as a gameplay workaround.For the actual local inputs, the 7,762,206,580-byte base package produced
FAIL: std::bad_allocunder the same cap. The 1,189,769-byte upgrade package first reported missingsce_module/*.prx; with the diagnostic flag it reportedInvalid ELF magic number: 7f 46 49 48. Neither package provided an extracted executable/module layout.Expected: reject a non-ELF input from a bounded header read before allocating for its entire size or checking bundled modules, and explain that an extracted clean ELF and its bundled modules are required. Valid ELF inputs should retain their existing handling.
Related: closed package-input PR #1056; SELF input questions #173 and #3508. This issue requests bounded rejection of unsupported input rather than reviving package support.
AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-20T21:40:42Z.
PR #8689 now addresses this with an early size check before allocating the full non-ELF input. On head
11adccfe15258e21e9ba6e90b947f674320ad9a8, the applicable relinker matrix passed on Linux, Windows, macOS arm64 and x86_64, plus ASan; conventions, eligibility and labels also pass. The full Linux/Windows build jobs are skipped under the repository’s manual-dispatch policy, and the issue remains open until the PR merges.