summaryrefslogtreecommitdiff
path: root/gdk-pixbuf/pixops
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2010-01-08 13:20:28 -0500
committerMatthias Clasen <mclasen@redhat.com>2010-01-08 13:24:33 -0500
commit1d4c6ebe5feae2566e005d260cc8a6f4285c7419 (patch)
tree37b23a7b5188bad9620d51fdbc503584aa47fb6d /gdk-pixbuf/pixops
parentf5b21802bbf02d89c61633286492f62109b0f2a2 (diff)
downloadgtk+-1d4c6ebe5feae2566e005d260cc8a6f4285c7419.tar.gz
Avoid an FPE for ludicrous scale values
...just bail out early.
Diffstat (limited to 'gdk-pixbuf/pixops')
-rw-r--r--gdk-pixbuf/pixops/pixops.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/gdk-pixbuf/pixops/pixops.c b/gdk-pixbuf/pixops/pixops.c
index 513d16fc8b..353021aad3 100644
--- a/gdk-pixbuf/pixops/pixops.c
+++ b/gdk-pixbuf/pixops/pixops.c
@@ -1251,11 +1251,20 @@ pixops_process (guchar *dest_buf,
int i, j;
int x, y; /* X and Y position in source (fixed_point) */
- guchar **line_bufs = g_new (guchar *, filter->y.n);
- int *filter_weights = make_filter_table (filter);
+ guchar **line_bufs;
+ int *filter_weights;
- int x_step = (1 << SCALE_SHIFT) / scale_x; /* X step in source (fixed point) */
- int y_step = (1 << SCALE_SHIFT) / scale_y; /* Y step in source (fixed point) */
+ int x_step;
+ int y_step;
+
+ x_step = (1 << SCALE_SHIFT) / scale_x; /* X step in source (fixed point) */
+ y_step = (1 << SCALE_SHIFT) / scale_y; /* Y step in source (fixed point) */
+
+ if (x_step == 0 || y_step == 0)
+ return; /* overflow, bail out */
+
+ line_bufs = g_new (guchar *, filter->y.n);
+ filter_weights = make_filter_table (filter);
int check_shift = check_size ? get_check_shift (check_size) : 0;