From 0e42abe1d884e8fb28bb1e8ffa638bf57c4bc381 Mon Sep 17 00:00:00 2001 From: Vishrut Sachan Date: Fri, 19 Jun 2026 18:48:34 +0530 Subject: [PATCH] cellSaveData: fix crash in FixedDelete with empty dirNamePrefix --- rpcs3/Emu/Cell/Modules/cellSaveData.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/rpcs3/Emu/Cell/Modules/cellSaveData.cpp b/rpcs3/Emu/Cell/Modules/cellSaveData.cpp index 7878e86642..b45aaf7d78 100644 --- a/rpcs3/Emu/Cell/Modules/cellSaveData.cpp +++ b/rpcs3/Emu/Cell/Modules/cellSaveData.cpp @@ -795,7 +795,7 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v std::vector prefix_list = fmt::split(setList->dirNamePrefix.get_ptr(), {"|"}); // if prefix_list is empty game wants to check all savedata - if (prefix_list.empty() && (operation == SAVEDATA_OP_LIST_LOAD || operation == SAVEDATA_OP_FIXED_LOAD)) + if (prefix_list.empty() && (operation == SAVEDATA_OP_LIST_LOAD || operation == SAVEDATA_OP_FIXED_LOAD || operation == SAVEDATA_OP_FIXED_DELETE)) { cellSaveData.notice("savedata_op(): dirNamePrefix is empty. Listing all entries. operation=%d", operation); prefix_list = {""}; @@ -1358,6 +1358,12 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v } } + if (operation == SAVEDATA_OP_FIXED_DELETE && (selected < 0 || static_cast(selected) >= save_entries.size())) + { + // No matching save entry found to delete + return {CELL_SAVEDATA_ERROR_NODATA, "FixedDelete: no save entry found for dirName"}; + } + switch (fixedSet->option) { case CELL_SAVEDATA_OPTION_NONE: