Util: Fix overflow when loading invalid UPS patches

This commit is contained in:
Vicki Pfau 2017-02-01 13:21:26 -08:00
parent 181c05c7ac
commit af77e5ab62
2 changed files with 4 additions and 0 deletions

View File

@ -21,6 +21,7 @@ Bugfixes:
- GB MBC: Fix ROM bank overflows getting set to bank 0 - GB MBC: Fix ROM bank overflows getting set to bank 0
- Qt: Fix timing issues on high refresh rate monitors - Qt: Fix timing issues on high refresh rate monitors
- GBA Savedata: Fix savedata unmasking (fixes mgba.io/i/441) - GBA Savedata: Fix savedata unmasking (fixes mgba.io/i/441)
- Util: Fix overflow when loading invalid UPS patches
Misc: Misc:
- SDL: Remove scancode key input - SDL: Remove scancode key input
- GBA Video: Clean up unused timers - GBA Video: Clean up unused timers

View File

@ -87,6 +87,9 @@ bool _UPSApplyPatch(struct Patch* patch, const void* in, size_t inSize, void* ou
if (patch->vf->read(patch->vf, &byte, 1) != 1) { if (patch->vf->read(patch->vf, &byte, 1) != 1) {
return false; return false;
} }
if (offset >= outSize) {
return false;
}
buf[offset] ^= byte; buf[offset] ^= byte;
++offset; ++offset;
if (!byte) { if (!byte) {