From d4dbebc606bdae6a765eada22e49787b47e277f1 Mon Sep 17 00:00:00 2001 From: David Schleef Date: Sat, 23 Apr 2011 13:42:23 -0700 Subject: [PATCH] videoscale: hack to fix invalid reads in linear https://bugzilla.gnome.org/show_bug.cgi?id=633837 --- gst/videoscale/vs_image.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/gst/videoscale/vs_image.c b/gst/videoscale/vs_image.c index 691914453f..6716ebad17 100644 --- a/gst/videoscale/vs_image.c +++ b/gst/videoscale/vs_image.c @@ -93,12 +93,12 @@ vs_image_scale_linear_RGBA (const VSImage * dest, const VSImage * src, if (dest->height == 1) y_increment = 0; else - y_increment = ((src->height - 1) << 16) / (dest->height - 1); + y_increment = ((src->height - 1) << 16) / (dest->height - 1) - 1; if (dest->width == 1) x_increment = 0; else - x_increment = ((src->width - 1) << 16) / (dest->width - 1); + x_increment = ((src->width - 1) << 16) / (dest->width - 1) - 1; dest_size = dest->width * 4; @@ -191,12 +191,12 @@ vs_image_scale_linear_RGB (const VSImage * dest, const VSImage * src, if (dest->height == 1) y_increment = 0; else - y_increment = ((src->height - 1) << 16) / (dest->height - 1); + y_increment = ((src->height - 1) << 16) / (dest->height - 1) - 1; if (dest->width == 1) x_increment = 0; else - x_increment = ((src->width - 1) << 16) / (dest->width - 1); + x_increment = ((src->width - 1) << 16) / (dest->width - 1) - 1; dest_size = dest->width * 3; @@ -321,12 +321,12 @@ vs_image_scale_linear_YUYV (const VSImage * dest, const VSImage * src, if (dest->height == 1) y_increment = 0; else - y_increment = ((src->height - 1) << 16) / (dest->height - 1); + y_increment = ((src->height - 1) << 16) / (dest->height - 1) - 1; if (dest->width == 1) x_increment = 0; else - x_increment = ((src->width - 1) << 16) / (dest->width - 1); + x_increment = ((src->width - 1) << 16) / (dest->width - 1) - 1; dest_size = ROUND_UP_4 (dest->width * 2); @@ -451,12 +451,12 @@ vs_image_scale_linear_UYVY (const VSImage * dest, const VSImage * src, if (dest->height == 1) y_increment = 0; else - y_increment = ((src->height - 1) << 16) / (dest->height - 1); + y_increment = ((src->height - 1) << 16) / (dest->height - 1) - 1; if (dest->width == 1) x_increment = 0; else - x_increment = ((src->width - 1) << 16) / (dest->width - 1); + x_increment = ((src->width - 1) << 16) / (dest->width - 1) - 1; dest_size = ROUND_UP_4 (dest->width * 2); @@ -576,12 +576,12 @@ vs_image_scale_linear_Y (const VSImage * dest, const VSImage * src, if (dest->height == 1) y_increment = 0; else - y_increment = ((src->height - 1) << 16) / (dest->height - 1); + y_increment = ((src->height - 1) << 16) / (dest->height - 1) - 1; if (dest->width == 1) x_increment = 0; else - x_increment = ((src->width - 1) << 16) / (dest->width - 1); + x_increment = ((src->width - 1) << 16) / (dest->width - 1) - 1; dest_size = dest->width; @@ -707,12 +707,12 @@ vs_image_scale_linear_Y16 (const VSImage * dest, const VSImage * src, if (dest->height == 1) y_increment = 0; else - y_increment = ((src->height - 1) << 16) / (dest->height - 1); + y_increment = ((src->height - 1) << 16) / (dest->height - 1) - 1; if (dest->width == 1) x_increment = 0; else - x_increment = ((src->width - 1) << 16) / (dest->width - 1); + x_increment = ((src->width - 1) << 16) / (dest->width - 1) - 1; dest_size = 2 * dest->width; @@ -837,12 +837,12 @@ vs_image_scale_linear_RGB565 (const VSImage * dest, const VSImage * src, if (dest->height == 1) y_increment = 0; else - y_increment = ((src->height - 1) << 16) / (dest->height - 1); + y_increment = ((src->height - 1) << 16) / (dest->height - 1) - 1; if (dest->width == 1) x_increment = 0; else - x_increment = ((src->width - 1) << 16) / (dest->width - 1); + x_increment = ((src->width - 1) << 16) / (dest->width - 1) - 1; dest_size = dest->width * 2; @@ -967,12 +967,12 @@ vs_image_scale_linear_RGB555 (const VSImage * dest, const VSImage * src, if (dest->height == 1) y_increment = 0; else - y_increment = ((src->height - 1) << 16) / (dest->height - 1); + y_increment = ((src->height - 1) << 16) / (dest->height - 1) - 1; if (dest->width == 1) x_increment = 0; else - x_increment = ((src->width - 1) << 16) / (dest->width - 1); + x_increment = ((src->width - 1) << 16) / (dest->width - 1) - 1; dest_size = dest->width * 2; @@ -1100,12 +1100,12 @@ vs_image_scale_linear_AYUV64 (const VSImage * dest, const VSImage * src, if (dest->height == 1) y_increment = 0; else - y_increment = ((src->height - 1) << 16) / (dest->height - 1); + y_increment = ((src->height - 1) << 16) / (dest->height - 1) - 1; if (dest->width == 1) x_increment = 0; else - x_increment = ((src->width - 1) << 16) / (dest->width - 1); + x_increment = ((src->width - 1) << 16) / (dest->width - 1) - 1; dest_size = dest->width * 8;