all repos — mgba @ 7b86d5cec770712915edbcd7bf1b0ad96d1938dd

mGBA Game Boy Advance Emulator

GB Serialize: Prevent loading savestates that aren't about to load an instruction
Jeffrey Pfau jeffrey@endrift.com
Mon, 12 Sep 2016 12:38:16 -0700
commit

7b86d5cec770712915edbcd7bf1b0ad96d1938dd

parent

13a68a0dac2bbc7cd47a8cc9007bea580f076338

1 files changed, 4 insertions(+), 0 deletions(-)

jump to
M src/gb/serialize.csrc/gb/serialize.c

@@ -112,6 +112,10 @@ if (check < 0) {

mLOG(GB_STATE, WARN, "Savestate is corrupted: CPU cycles are negative"); error = true; } + if (state->cpu.executionState != LR35902_CORE_FETCH) { + mLOG(GB_STATE, WARN, "Savestate is corrupted: Execution state is not FETCH"); + error = true; + } if (check >= (int32_t) DMG_LR35902_FREQUENCY) { mLOG(GB_STATE, WARN, "Savestate is corrupted: CPU cycles are too high"); error = true;