mirror of https://github.com/mgba-emu/mgba.git
Test: Fix crash when fuzzing fails to load a file
This commit is contained in:
parent
422c3a25b8
commit
870c375cf6
1
CHANGES
1
CHANGES
|
@ -47,6 +47,7 @@ Bugfixes:
|
||||||
- Core: Fix crash with rewind if savestates shrink
|
- Core: Fix crash with rewind if savestates shrink
|
||||||
- Test: Fix crash when loading invalid file
|
- Test: Fix crash when loading invalid file
|
||||||
- GBA Hardware: Fix crash if a savestate lies about game hardware
|
- GBA Hardware: Fix crash if a savestate lies about game hardware
|
||||||
|
- Test: Fix crash when fuzzing fails to load a file
|
||||||
Misc:
|
Misc:
|
||||||
- SDL: Remove scancode key input
|
- SDL: Remove scancode key input
|
||||||
- GBA Video: Clean up unused timers
|
- GBA Video: Clean up unused timers
|
||||||
|
|
|
@ -94,10 +94,15 @@ int main(int argc, char** argv) {
|
||||||
#ifdef __AFL_HAVE_MANUAL_CONTROL
|
#ifdef __AFL_HAVE_MANUAL_CONTROL
|
||||||
__AFL_INIT();
|
__AFL_INIT();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
bool cleanExit = true;
|
||||||
|
if (!mCoreLoadFile(core, args.fname)) {
|
||||||
|
cleanExit = false;
|
||||||
|
goto loadError;
|
||||||
|
}
|
||||||
if (args.patch) {
|
if (args.patch) {
|
||||||
core->loadPatch(core, VFileOpen(args.patch, O_RDONLY));
|
core->loadPatch(core, VFileOpen(args.patch, O_RDONLY));
|
||||||
}
|
}
|
||||||
mCoreLoadFile(core, args.fname);
|
|
||||||
|
|
||||||
struct VFile* savestate = 0;
|
struct VFile* savestate = 0;
|
||||||
struct VFile* savestateOverlay = 0;
|
struct VFile* savestateOverlay = 0;
|
||||||
|
@ -158,13 +163,14 @@ int main(int argc, char** argv) {
|
||||||
savestateOverlay->close(savestateOverlay);
|
savestateOverlay->close(savestateOverlay);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
loadError:
|
||||||
freeArguments(&args);
|
freeArguments(&args);
|
||||||
if (outputBuffer) {
|
if (outputBuffer) {
|
||||||
free(outputBuffer);
|
free(outputBuffer);
|
||||||
}
|
}
|
||||||
core->deinit(core);
|
core->deinit(core);
|
||||||
|
|
||||||
return 0;
|
return !cleanExit;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _fuzzRunloop(struct mCore* core, int frames) {
|
static void _fuzzRunloop(struct mCore* core, int frames) {
|
||||||
|
|
Loading…
Reference in New Issue