diff --git a/src/core/libraries/kernel/process.cpp b/src/core/libraries/kernel/process.cpp index 3a747bf16..58628867a 100644 --- a/src/core/libraries/kernel/process.cpp +++ b/src/core/libraries/kernel/process.cpp @@ -75,6 +75,9 @@ s32 PS4_SYSV_ABI sceKernelLoadStartModule(const char* moduleFileName, size_t arg s32 PS4_SYSV_ABI sceKernelDlsym(s32 handle, const char* symbol, void** addrp) { auto* linker = Common::Singleton::Instance(); auto* module = linker->GetModule(handle); + if (module == nullptr) { + return ORBIS_KERNEL_ERROR_ESRCH; + } *addrp = module->FindByName(symbol); if (*addrp == nullptr) { return ORBIS_KERNEL_ERROR_ESRCH; diff --git a/src/core/linker.h b/src/core/linker.h index 357b39664..9c07400c4 100644 --- a/src/core/linker.h +++ b/src/core/linker.h @@ -83,7 +83,10 @@ public: } Module* GetModule(s32 index) const { - return m_modules.at(index).get(); + if (index >= 0 || index < m_modules.size()) { + return m_modules.at(index).get(); + } + return nullptr; } u32 FindByName(const std::filesystem::path& name) const {