fix(relinker): reject overflowing signed unwind LEB128 values #2245
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2245"
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 NumberGuan on 2026-10-09T13:06:36Z.
What
EhFrameReader::lebaccepts a tenth-byte payload of1for both unsigned and signed 64-bit LEB128. In the signed case, nine0x80bytes followed by0x01encode positive 2^63, which does not fit inint64_t. The reader accepts it and returns the bit pattern ofINT64_MIN.Use separate overflow limits: the tenth payload may be
0or0x7Ffor SLEB128, and0or1for ULEB128. This matches the LLVM 20.1.8 decoder. The existing error reports malformed unwind data instead of silently accepting the overflow.Add a regression to the registered
strict_nid_filtertest. It reads a complete EH frame header, CIE and FDE throughReadExceptionFunctions. The fixture checks all 128 terminating payloads with two prefixes, in signed and unsigned CIE fields: 512 boundary combinations plus a normal short encoding. Accepted encodings must preserve the function range and targets; rejected ones must produce the overflow diagnostic.This is independent of #1944, which changes LSDA handling in the same reader.
git merge-treecombines the two branches without conflicts. No dependency.Tested
Windows x64, WinLibs MinGW-w64 GCC 15.2.0 UCRT POSIX SEH r7, Ninja Release, Python 3.12.14. Based on upstream
d70b8998; contribution682d6f62.All 40 registered test groups passed. Registration, conventions and whitespace checks passed.
strict_nid_filtertook 0.28 seconds. The existingtls_function_coveragetest took 67.63 seconds; no repository timeout was changed.With only the regression added to the original implementation,
strict_nid_filterfails withOverflowing CIE LEB128 value was accepted. It passes with the one-line fix.GitHub Actions passed Conventions and the relinker build/test matrix on Windows, Linux and macOS for
682d6f62: Build run, Conventions run. The full Linux and Windows build jobs were skipped under the repository's pull-request policy. System-library builds and game/PS5 tests were not run locally.Checklist
main; no other open PR implements the same functionsImported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-09T13:35:43Z.
Review: APPROVED
Reviewed the complete two-file diff and verified the boundary logic: at bit 63, signed payloads allow only 0 or 0x7f, while unsigned payloads allow only 0 or 1; continued tenth bytes still hit the existing unterminated-value guard. I built the full relinker-only target and ran on the exact head (1/1 passed). Conventions and diff checks pass, and the official Linux, Windows, and macOS relinker jobs are green. No blocking issues found.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-09T13:36:00Z.
Review: COMMENTED
For clarity, the focused CTest I ran on this head was
strict_nid_filter(1/1 passed). The full relinker-only build and the official Linux, Windows, and macOS relinker jobs also passed.