all repos — mgba @ c292f7ea93a0d653b56891bf1adb318ab9ac3063

mGBA Game Boy Advance Emulator

GB Serialize: Check for X when loading state
Jeffrey Pfau jeffrey@endrift.com
Mon, 12 Sep 2016 20:14:18 -0700
commit

c292f7ea93a0d653b56891bf1adb318ab9ac3063

parent

65de1caa0cb0f78910eb12edb9d0bfb3d8bd556f

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

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

@@ -127,6 +127,11 @@ if (check < 0) {

mLOG(GB_STATE, WARN, "Savestate is corrupted: video eventDiff is negative"); error = true; } + LOAD_16LE(check16, 0, &state->video.x); + if (check16 < 0 || check16 > GB_VIDEO_HORIZONTAL_PIXELS) { + mLOG(GB_STATE, WARN, "Savestate is corrupted: video x is out of range"); + error = true; + } LOAD_16LE(check16, 0, &state->video.ly); if (check16 < 0 || check16 > GB_VIDEO_VERTICAL_TOTAL_PIXELS) { mLOG(GB_STATE, WARN, "Savestate is corrupted: video y is out of range");