From e1b40d86901fa0cce2568df412f657ad6bcbd1c2 Mon Sep 17 00:00:00 2001 From: H.G.Muller Date: Fri, 9 Feb 2018 17:11:27 +0100 Subject: [PATCH] Fix crash by using texture in black square When BlankSquare was called with square_color = 2 to black out a square (as when drawing holdings), it tried to use a non-existent texture bitmap for this when background textures were on, risking a segfault in Cairo. --- draw.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/draw.c b/draw.c index 79518a0..5190d56 100644 --- a/draw.c +++ b/draw.c @@ -774,7 +774,7 @@ DrawLogo (Option *opt, void *logo) static void BlankSquare (cairo_surface_t *dest, int x, int y, int color, ChessSquare piece, int fac) { // [HGM] extra param 'fac' for forcing destination to (0,0) for copying to animation buffer - int x0, y0, texture = (useTexture & color+1) && CutOutSquare(x, y, &x0, &y0, color); + int x0, y0, texture = color < 2 && (useTexture & color+1) && CutOutSquare(x, y, &x0, &y0, color); cairo_t *cr; cr = cairo_create (dest); -- 1.7.0.4