From a62027d4c2a39a596eac72b78f73eb4123e4188b Mon Sep 17 00:00:00 2001 From: Fire Cube Date: Sat, 21 Jun 2025 09:03:10 +0200 Subject: [PATCH] fix potential out of bound crash (#3132) --- src/core/libraries/np_trophy/np_trophy.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/core/libraries/np_trophy/np_trophy.cpp b/src/core/libraries/np_trophy/np_trophy.cpp index e3c5ce35e..c0642f81c 100644 --- a/src/core/libraries/np_trophy/np_trophy.cpp +++ b/src/core/libraries/np_trophy/np_trophy.cpp @@ -199,6 +199,10 @@ int PS4_SYSV_ABI sceNpTrophyDestroyContext(OrbisNpTrophyContext context) { Common::SlotId contextId; contextId.index = context - 1; + if (contextId.index >= trophy_contexts.size()) { + return ORBIS_NP_TROPHY_ERROR_INVALID_CONTEXT; + } + ContextKey contextkey = trophy_contexts[contextId]; trophy_contexts.erase(contextId); contexts_internal.erase(contextkey);