From: simon Date: Tue, 7 Jun 2005 19:07:58 +0000 (+0000) Subject: James Harvey (again) points out an array underrun in the new X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/puzzles/commitdiff_plain/5d744557ee36c9408bacad0974c6b16b42de8d94 James Harvey (again) points out an array underrun in the new clash-checking code in Solo. (valgrind confirms it.) git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5916 cda61777-01e9-0310-a592-d414129be87e --- diff --git a/solo.c b/solo.c index 2f8ec23..d564ad2 100644 --- a/solo.c +++ b/solo.c @@ -2238,9 +2238,9 @@ static void game_redraw(frontend *fe, game_drawstate *ds, game_state *oldstate, /* Mark obvious errors (ie, numbers which occur more than once * in a single row, column, or box). */ - if ((ds->entered_items[x*cr+d-1] & 2) || - (ds->entered_items[y*cr+d-1] & 8) || - (ds->entered_items[((x/r)+(y/c)*c)*cr+d-1] & 32)) + if (d && ((ds->entered_items[x*cr+d-1] & 2) || + (ds->entered_items[y*cr+d-1] & 8) || + (ds->entered_items[((x/r)+(y/c)*c)*cr+d-1] & 32))) highlight |= 16; draw_number(fe, ds, state, x, y, highlight);