GBA: Add more savestate checks
Jeffrey Pfau jeffrey@endrift.com
Wed, 03 Jun 2015 20:41:47 -0700
1 files changed,
8 insertions(+),
0 deletions(-)
jump to
M
src/gba/serialize.c
→
src/gba/serialize.c
@@ -78,12 +78,20 @@ if (state->cpu.cycles < 0) {
GBALog(gba, GBA_LOG_WARN, "Savestate is corrupted: CPU cycles are negative"); return; } + if (state->video.eventDiff < 0) { + GBALog(gba, GBA_LOG_WARN, "Savestate is corrupted: video eventDiff is negative"); + return; + } if (state->video.nextHblank - state->video.eventDiff < 0) { GBALog(gba, GBA_LOG_WARN, "Savestate is corrupted: nextHblank is negative"); return; } if (state->timers[0].overflowInterval < 0 || state->timers[1].overflowInterval < 0 || state->timers[2].overflowInterval < 0 || state->timers[3].overflowInterval < 0) { GBALog(gba, GBA_LOG_WARN, "Savestate is corrupted: overflowInterval is negative"); + return; + } + if (state->audio.eventDiff < 0) { + GBALog(gba, GBA_LOG_WARN, "Savestate is corrupted: audio eventDiff is negative"); return; } if (state->audio.ch1.envelopeNextStep < 0 || state->audio.ch1.waveNextStep < 0 || state->audio.ch1.sweepNextStep < 0 || state->audio.ch1.nextEvent < 0) {