chiark / gitweb /
Attempting to begin a drag from (i.e. just click on) the hint pegs
authorSimon Tatham <anakin@pobox.com>
Thu, 30 Jun 2005 08:25:47 +0000 (08:25 +0000)
committerSimon Tatham <anakin@pobox.com>
Thu, 30 Jun 2005 08:25:47 +0000 (08:25 +0000)
for a past guess caused strangeness up to and including segfault,
thanks to bad bounds checking. Well spotted John Sullivan.

[originally from svn r6040]

guess.c

diff --git a/guess.c b/guess.c
index bf7a1484456d5b97d0623fbf2afa08dea3a3c682..12d8b1b3ad6be70483dccd87381946b20e9706f6 100644 (file)
--- a/guess.c
+++ b/guess.c
@@ -637,7 +637,7 @@ static char *interpret_move(game_state *from, game_ui *ui, game_drawstate *ds,
         } else {
             over_hint = 1;
         }
-    } else if (x >= guess_ox &&
+    } else if (x >= guess_ox && x <= (guess_ox + GUESS_W) &&
                y >= GUESS_OY && y < guess_oy) {
         over_past_guess_y = (y - GUESS_OY) / PEGOFF;
         over_past_guess_x = (x - guess_ox) / PEGOFF;