GBA: Check for improperly sized savestates when loading

This commit is contained in:
Jeffrey Pfau 2015-06-01 20:53:41 -07:00
parent ee6e53cfc8
commit 502ca7abd7
2 changed files with 4 additions and 0 deletions

View File

@ -35,6 +35,7 @@ Bugfixes:
- Qt: Fix maximum year in sensor override
- GBA: Cap audio FIFO read size during deserialization
- GBA: Check for corrupted savestates when loading
- GBA: Check for improperly sized savestates when loading
Misc:
- Qt: Handle saving input settings better
- Debugger: Free watchpoints in addition to breakpoints

View File

@ -264,6 +264,9 @@ bool GBALoadStateNamed(struct GBA* gba, struct VFile* vf) {
return _loadPNGState(gba, vf);
}
#endif
if (vf->size(vf) < (ssize_t) sizeof(struct GBASerializedState)) {
return false;
}
struct GBASerializedState* state = vf->map(vf, sizeof(struct GBASerializedState), MAP_READ);
if (!state) {
return false;