From 039c69f0318dcbe10a94933d70c397cb612265f8 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sat, 11 Nov 2017 08:08:59 -0800 Subject: [PATCH] SaveState: Fix use-after-resize iterator. Only on older save states. --- Core/HLE/sceKernelModule.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Core/HLE/sceKernelModule.cpp b/Core/HLE/sceKernelModule.cpp index 2630cde19f..3c8170b829 100644 --- a/Core/HLE/sceKernelModule.cpp +++ b/Core/HLE/sceKernelModule.cpp @@ -301,7 +301,9 @@ public: } else { // Older save state. Let's still reload, but this may not pick up new flags, etc. bool foundBroken = false; - for (auto func : importedFuncs) { + auto importedFuncsState = importedFuncs; + importedFuncs.clear(); + for (auto func : importedFuncsState) { if (func.moduleName[KERNELOBJECT_MAX_NAME_LENGTH] != '\0' || !Memory::IsValidAddress(func.stubAddr)) { foundBroken = true; } else {