From: Holger Schemel Date: Sat, 27 Aug 2022 08:54:07 +0000 (+0200) Subject: fixed crash bug when accessing invalid change page for broken level files X-Git-Tag: 4.3.3.0~72 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=bfa029317730e611f3f7a687ad679ac92ece898f;p=rocksndiamonds.git fixed crash bug when accessing invalid change page for broken level files Thanks to Quipyowert for finding and fixing this bug! --- diff --git a/src/files.c b/src/files.c index 09e3b4d2..45f4097f 100644 --- a/src/files.c +++ b/src/files.c @@ -3355,6 +3355,10 @@ static int LoadLevel_CUSX(File *file, int chunk_size, struct LevelInfo *level) while (!checkEndOfFile(file)) { + // level file might contain invalid change page number + if (xx_current_change_page >= ei->num_change_pages) + break; + struct ElementChangeInfo *change = &ei->change_page[xx_current_change_page]; xx_change = *change; // copy change data into temporary buffer