From 7c61445fe3203c591429d8d123cad6191aa9874f Mon Sep 17 00:00:00 2001 From: Lior Halphon Date: Fri, 21 Jun 2019 03:04:38 +0300 Subject: [PATCH] Fixed out of bound read in GB_load_state_from_buffer. Closes #104 --- Core/save_state.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Core/save_state.c b/Core/save_state.c index 1cd3458..5a7d920 100644 --- a/Core/save_state.c +++ b/Core/save_state.c @@ -294,6 +294,8 @@ static bool buffer_read_section(const uint8_t **buffer, size_t *buffer_length, v return false; } + if (saved_size > *buffer_length) return false; + if (saved_size <= size) { if (buffer_read(dest, saved_size, buffer, buffer_length) != saved_size) { return false;