shithub: puzzles

Download patch

ref: 101324af67c5e7819849daeafb337dd4c1f45828
parent: 0494e94c4ace69b89e46943c2ddc1f8d09c44c8c
author: Simon Tatham <anakin@pobox.com>
date: Thu Jun 30 04:25:47 EDT 2005

Attempting to begin a drag from (i.e. just click on) the hint pegs
for a past guess caused strangeness up to and including segfault,
thanks to bad bounds checking. Well spotted John Sullivan.

[originally from svn r6040]

--- a/guess.c
+++ b/guess.c
@@ -637,7 +637,7 @@
         } 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;