From 43fb86320e239537882658cc3d9b4f399ae5f7c0 Mon Sep 17 00:00:00 2001 From: Lior Halphon Date: Tue, 13 Apr 2021 22:05:13 +0300 Subject: [PATCH] Hard fail on unexpected SGB blocks --- Core/save_state.c | 1 + 1 file changed, 1 insertion(+) diff --git a/Core/save_state.c b/Core/save_state.c index 89924ac..6ef62c1 100644 --- a/Core/save_state.c +++ b/Core/save_state.c @@ -987,6 +987,7 @@ static int load_bess_save(GB_gameboy_t *gb, virtual_file_t *file, bool is_samebo break; case BE32('SGB '): if (!found_core) goto parse_error; + if (!gb->sgb) goto parse_error; if (LE32(block.size) != sizeof(BESS_SGB_t) - sizeof(block)) goto parse_error; file->read(file, &sgb.header + 1, sizeof(BESS_SGB_t) - sizeof(block)); found_sgb = true;