mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-10 01:28:44 +02:00
fix(relinker): name the second SELF container magic as a SELF input
ElfReader::ReadHeader names 0x1D3D154F as a SELF container, but dumps also carry a second container magic, 0xEEF51454 (bytes 54 14 f5 ee), which fell through to "Invalid ELF magic number: 54 14 f5 ee". That message reads as a corrupt input rather than an encrypted one, so a user cannot tell that decryption is what stands between them and a relink. Both magics now report the SELF message. Measured on two retail dumps: PPSA03671's eboot.bin and libcohtml.Prospero.prx are 54 14 f5 ee; PPSA28997's eboot and modules are 4f 15 3d 1d. Tested: Linux (CachyOS, GCC, Release, BUILD_TESTING=ON), relinker rebuilt. The new case fails on the revert of the reader change with the exact message above and passes with it; elf_header, elf_offsets, dynamic_segment, string_table_bounds, guest_needed_modules, guest_module_directories and linux_load_alignment still pass.
This commit is contained in:
@@ -74,7 +74,8 @@ ElfHeader ElfReader::ReadHeader() const {
|
||||
throw RelinkerException("File too small for ELF header");
|
||||
}
|
||||
|
||||
if (_fileBuffer[0] == 0x4f && _fileBuffer[1] == 0x15 && _fileBuffer[2] == 0x3d && _fileBuffer[3] == 0x1d) {
|
||||
const std::uint32_t magic = _readU32At(0);
|
||||
if (magic == 0x1d3d154f || magic == 0xeef51454) {
|
||||
throw RelinkerException("The input is a SELF container, not an ELF");
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ def main():
|
||||
assert result.returncode == 2 and error in result.stderr and not output.exists(), (name, result)
|
||||
|
||||
convert("eboot.self", b"\x4f\x15\x3d\x1d" + bytes(0x1000), "The input is a SELF container, not an ELF")
|
||||
convert("eboot.self.kernel", b"\x54\x14\xf5\xee" + bytes(0x1000), "The input is a SELF container, not an ELF")
|
||||
convert("eboot.pkg", b"\x7fCNT" + bytes(0x1000), "Invalid ELF magic number: 7f 43 4e 54")
|
||||
convert("eboot.short", b"\x7fEL", "File too small for ELF header")
|
||||
print("Input magic diagnostics tests passed")
|
||||
|
||||
Reference in New Issue
Block a user