fix potential out of bound crash (#3132)

This commit is contained in:
Fire Cube 2025-06-21 09:03:10 +02:00 committed by GitHub
parent 8dcd9cc0f9
commit a62027d4c2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -199,6 +199,10 @@ int PS4_SYSV_ABI sceNpTrophyDestroyContext(OrbisNpTrophyContext context) {
Common::SlotId contextId; Common::SlotId contextId;
contextId.index = context - 1; contextId.index = context - 1;
if (contextId.index >= trophy_contexts.size()) {
return ORBIS_NP_TROPHY_ERROR_INVALID_CONTEXT;
}
ContextKey contextkey = trophy_contexts[contextId]; ContextKey contextkey = trophy_contexts[contextId];
trophy_contexts.erase(contextId); trophy_contexts.erase(contextId);
contexts_internal.erase(contextkey); contexts_internal.erase(contextkey);