fix(relinker): validate complete relocation symbol entries #4952
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4952"
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 Ondra97 on 2026-10-13T06:06:59Z.
What
The executable relocation reader accepted symbol indices beyond
DT_OS_SYMTABSZwhen the bytes remained inside the file. A Linux fixture declaring only the null symbol (24 bytes), but referring to symbol 1, exited successfully and wrote an output. Named imports also required only five bytes of a 24-byte symbol entry.Use one symbol-position check for ordinary imports and the zero-value section symbols accepted by RELATIVE relocations. Require a complete symbol record and respect the declared table size when present. NONE relocations continue to ignore their symbol field. Export handling is unchanged.
Tested
Windows 11 x64, WinLibs MinGW-w64 GCC 15.2.0, Python 3.14, Release relinker-only with BUILD_TESTING=ON. Rebased onto current
maina5f493f90dca348a65561aed4bb325a629d1b668; headf10ab0b6ab9dc9e3e897be9c458d828d91168c69.Related #5229 preserves executable defined-symbol relocations and partly overlaps the ordinary symbol read. This bounds correction does not depend on that feature; its rebase needs to retain the common bounds lookup. Their combination was not built or tested here.
No console title or Linux/macOS host execution was performed during this rebase validation.
Checklist
main; no other open PR implements the same fixImported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-13T08:41:15Z.
Windows test: head
5e5ce90f0merged onto currentmain5f426f947(clean merge, no conflicts). Windows 10, MinGW GCC (WinLibs), Ninja Release,-j2: full build 0 errors; ctest with the filter^jmprel_table_bounds$: jmprel_table_bounds passed (1 test(s), 0 failed);python tools/check_conventions.py --base upstream/mainpassed. I did not run the new tests againstmainwithout the change.AI-assisted (Claude Code).