From 5b68c50d7d2afec203e0b8dec0971f7de3b65b61 Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Sat, 14 Apr 2012 23:16:29 +0200 Subject: [PATCH] Fix ArrowDamage out-of-bounds access on drop moves --- board.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/board.c b/board.c index 0bc81f8..4de6269 100644 --- a/board.c +++ b/board.c @@ -148,7 +148,7 @@ int pm1X = -1, pm1Y = -1, pm2X = -1, pm2Y = -1; void SetHighlights (int fromX, int fromY, int toX, int toY) { - int arrow = hi2X > 0 && IsDrawArrowEnabled(); + int arrow = hi2X >= 0 && hi1Y >= 0 && IsDrawArrowEnabled(); if (hi1X != fromX || hi1Y != fromY) { if (hi1X >= 0 && hi1Y >= 0) { @@ -181,7 +181,7 @@ SetHighlights (int fromX, int fromY, int toX, int toY) hi2X = toX; hi2Y = toY; - if(arrow || toX < 0 && IsDrawArrowEnabled()) + if(arrow || toX >= 0 && fromY >= 0 && IsDrawArrowEnabled()) DrawPosition(FALSE, NULL); // repair any arrow damage, or draw a new one } -- 1.7.0.4