From: Holger Schemel Date: Tue, 1 Mar 2022 17:18:07 +0000 (+0100) Subject: fixed crash bug for some graphics configurations with global border X-Git-Tag: 4.3.2.0~99 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=8c16b35bafd9a51060095bff4a62fc327c4cf495;p=rocksndiamonds.git fixed crash bug for some graphics configurations with global border This crash may happen if parts of a global screen border graphic are configured to be drawn (like "border.draw_masked.DOOR: true") while the global screen border graphic itself is configured to be undefined (like "global.border.MAIN: [NONE]"), which causes an attempt to blit from a bitmap that is NULL, resulting in a segmentation fault. This commit adds a check to prevent this. --- diff --git a/src/tools.c b/src/tools.c index 144bce2a..c8070fa2 100644 --- a/src/tools.c +++ b/src/tools.c @@ -512,6 +512,10 @@ static void DrawMaskedBorderExt_Rect(int x, int y, int width, int height, Bitmap *src_bitmap = getGlobalBorderBitmapFromStatus(global.border_status); Bitmap *dst_bitmap = gfx.masked_border_bitmap_ptr; + // may happen for "border.draw_masked.*" with undefined "global.border.*" + if (src_bitmap == NULL) + return; + if (x == -1 && y == -1) return;