From 3481016567f435404cfd0ea0e3e6c4addd6aed35 Mon Sep 17 00:00:00 2001 From: William Kendrick Date: Sun, 12 Dec 2004 23:36:41 +0000 Subject: [PATCH] "i" wasn't getting reset after goto, causing segfault on Bill's box ("while (i--)" when i was 0 would cause overflow) --- src/tuxpaint.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/tuxpaint.c b/src/tuxpaint.c index aef04fef2..a7aa6ef83 100644 --- a/src/tuxpaint.c +++ b/src/tuxpaint.c @@ -3544,6 +3544,9 @@ static multichan *find_most_saturated(double initial_hue, multichan * work, // find the most saturated pixel near the initial hue guess multichan *key_color_ptr = NULL; double hue_range; + unsigned int orig_i; + + orig_i = i; switch (inf_stamps[cur_stamp]->tinter) { @@ -3578,8 +3581,11 @@ hue_range_retry:; upper_hue_2 = upper_hue_1 - 2 * M_PI; } + i = orig_i; while (i--) { + //if (i < 10 || i > 20000) + // printf("%d\n", i); fflush(stdout); mc = work + i; // if not in the first range, and not in the second range, skip this one