fixed potential crash bug when loading custom artwork
authorHolger Schemel <holger.schemel@virtion.de>
Thu, 1 Oct 2020 19:04:15 +0000 (21:04 +0200)
committerHolger Schemel <holger.schemel@virtion.de>
Thu, 1 Oct 2020 19:04:15 +0000 (21:04 +0200)
This patch fixes a memory corruption bug that potentially leads to
program crashes when loading custom artwork (or level sets with custom
artwork) by accessing a potentially invalid bitmap pointer (used for
the global border bitmap).

src/tools.c

index a4199a14600fb5083b61ed92e6a45debb1beb0b9..a041e1854ac2017d50514fa8493d9d55ed6797c1 100644 (file)
@@ -1337,6 +1337,9 @@ static void RedrawGlobalBorderIfNeeded(void)
 
 #if ONLY_REDRAW_GLOBAL_BORDER_IF_NEEDED
   if (CheckIfGlobalBorderRedrawIsNeeded())
+#else
+  // determine and store new global border bitmap for current game status
+  global_border_bitmap = getGlobalBorderBitmapFromStatus(game_status);
 #endif
   {
     // redraw global screen border (or clear, if defined to be empty)