fix(kernel/elf): check if vector is empty before calling .front()

This commit is contained in:
EnderIce2 2025-04-18 12:36:33 +00:00
parent 366fd97c0a
commit f5c9b561a9
Signed by: enderice2
GPG Key ID: FEB6B8A8507BA62E

View File

@ -455,13 +455,14 @@ namespace Execute
debug("gdb: \"-exec add-symbol-file-all /workspaces/Fennix/tmp_rootfs%s %#lx\" entry:%#lx", sanitizedPath.c_str(), base, entry);
#endif
Elf_Phdr interp = ELFGetSymbolType(fd, PT_INTERP).front();
if (interp.p_offset == 0)
std::vector<Elf_Phdr> interpVec = ELFGetSymbolType(fd, PT_INTERP);
if (interpVec.empty())
{
debug("No interpreter found");
return;
}
Elf_Phdr interp = interpVec.front();
std::string interpreterPath;
interpreterPath.resize(256);
fd->Read(interpreterPath.data(), 256, interp.p_offset);