From: Florian Forster Date: Sat, 18 Aug 2007 11:06:19 +0000 (+0200) Subject: panolib.c: Fixed argument-checking in the bilinear interpolation. X-Git-Url: https://git.octo.it/?p=libopano.git;a=commitdiff_plain;h=37da36e515306b3a538731220ee25f665071e892 panolib.c: Fixed argument-checking in the bilinear interpolation. --- diff --git a/src/panolib.c b/src/panolib.c index 2686059..6d503d6 100644 --- a/src/panolib.c +++ b/src/panolib.c @@ -91,16 +91,16 @@ static int copy_pixel (ui_image_t *dest, const ui_image_t *src, int i; x_src_left = (int) x_src_fp; - x_src_right = x_src_left + 1; + x_src_right = (x_src_left + 1) % src->width; + y_src_top = (int) y_src_fp; y_src_bottom = y_src_top + 1; + if (y_src_bottom >= src->height) + y_src_bottom = src->height - 1; x_right_frac = x_src_fp - x_src_left; y_bottom_frac = y_src_fp - y_src_top; - assert (x_src_right < src->width); - assert (y_src_bottom < src->height); - assert ((x_right_frac >= 0.0) && (x_right_frac <= 1.0)); assert ((y_bottom_frac >= 0.0) && (y_bottom_frac <= 1.0));