[gegl] operations/external/save-pixbuf: Try to avoid integer overflow



commit 923ae874551e5777bec253c945b8667d691614bc
Author: Debarshi Ray <debarshir gnome org>
Date:   Thu Feb 23 15:43:37 2017 +0100

    operations/external/save-pixbuf: Try to avoid integer overflow
    
    g_malloc0_n is safer than g_malloc0 since it detects any possible
    overflow during multiplication.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=779136

 operations/external/save-pixbuf.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/operations/external/save-pixbuf.c b/operations/external/save-pixbuf.c
index e19d50d..0bc63f0 100644
--- a/operations/external/save-pixbuf.c
+++ b/operations/external/save-pixbuf.c
@@ -72,7 +72,7 @@ process (GeglOperation       *operation,
       bpp = babl_format_get_bytes_per_pixel (babl);
       stride = bpp * rect->width;
 
-      temp = g_malloc0 (stride * rect->height);
+      temp = g_malloc0_n (stride, rect->height);
       gegl_buffer_get (input, rect, 1.0, babl, temp, stride,
                        GEGL_ABYSS_NONE);
       if (temp) {


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