Merge pull request #1317 from Dextroid17/fix/name-both-self-container-magics

fix(relinker): name the second SELF container magic as a SELF input
This commit is contained in:
Dean
2026-10-08 22:36:28 +13:00
committed by GitHub
2 changed files with 3 additions and 1 deletions
@@ -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")