all repos — mgba @ 0d6a0ed37516957c5879ea85b88c78b1940f7915

mGBA Game Boy Advance Emulator

GB, GBA: Fix crashes when attempting to identify null VFiles
Vicki Pfau vi@endrift.com
Sat, 29 Jul 2017 17:32:36 -0700
commit

0d6a0ed37516957c5879ea85b88c78b1940f7915

parent

8684a0b221fbf7113dc21e7b4cc624acac195b42

3 files changed, 7 insertions(+), 0 deletions(-)

jump to
M CHANGESCHANGES

@@ -10,6 +10,7 @@ - GB Video: Fix 16-bit screenshots (fixes mgba.io/i/826)

- GB Core: Fix palette loading when loading a foreign config - Qt: Fix LOG argument order - GB Memory: Prevent accessing empty SRAM (fixes mgba.io/i/831) + - GB, GBA: Fix crashes when attempting to identify null VFiles Misc: - Qt: Don't rebuild library view if style hasn't changed - SDL: Fix 2.0.5 build on macOS under some circumstances
M src/gb/gb.csrc/gb/gb.c

@@ -655,6 +655,9 @@ --cpu->pc;

} bool GBIsROM(struct VFile* vf) { + if (!vf) { + return false; + } vf->seek(vf, 0x104, SEEK_SET); uint8_t header[4];
M src/gba/gba.csrc/gba/gba.c

@@ -475,6 +475,9 @@ gba->debugFlags = GBADebugFlagsClearSend(gba->debugFlags);

} bool GBAIsROM(struct VFile* vf) { + if (!vf) { + return false; + } if (vf->seek(vf, GBA_ROM_MAGIC_OFFSET, SEEK_SET) < 0) { return false; }