[gegl] pixelize: avoid integer overflow when choosing code paths



commit fa819748659360fd5e10155a787e6fca31d77bbb
Author: Øyvind Kolås <pippin gimp org>
Date:   Tue Jun 19 17:05:01 2018 +0200

    pixelize: avoid integer overflow when choosing code paths
    
    For block sizes larger than 65535 the wrong code paths get chosen
    since the squared size is larger than 32bit. Casting the values
    compared to longs fixes issue #78 - https://gitlab.gnome.org/GNOME/gegl/issues/78

 operations/common/pixelize.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/operations/common/pixelize.c b/operations/common/pixelize.c
index 8c187a9b3..a113124d1 100644
--- a/operations/common/pixelize.c
+++ b/operations/common/pixelize.c
@@ -569,7 +569,7 @@ process (GeglOperation       *operation,
     if (cl_process (operation, input, output, roi))
       return TRUE;
 
-  if (o->size_x * o->size_y < SQR (ALLOC_THRESHOLD_SIZE))
+  if ((long)o->size_x * (long)o->size_y < SQR (ALLOC_THRESHOLD_SIZE))
     {
       gfloat  background_color[4];
       gfloat *input_buf  = g_new (gfloat,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]