[gnome-photos] image-view: Try to avoid integer overflow



commit dc7a11a69123bfebd611f52c3d84964bba58d09a
Author: Debarshi Ray <debarshir gnome org>
Date:   Thu Feb 23 15:52:31 2017 +0100

    image-view: Try to avoid integer overflow
    
    g_malloc0_n is safer than g_malloc0 since it detects any possible
    overflow during multiplication.

 src/photos-image-view.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/src/photos-image-view.c b/src/photos-image-view.c
index ad82e74..8405758 100644
--- a/src/photos-image-view.c
+++ b/src/photos-image-view.c
@@ -232,7 +232,7 @@ photos_image_view_draw_node (PhotosImageView *self, cairo_t *cr, GdkRectangle *r
 
   format = babl_format ("cairo-ARGB32");
   stride = cairo_format_stride_for_width (CAIRO_FORMAT_ARGB32, roi.width);
-  buf = g_malloc0 (stride * roi.height);
+  buf = g_malloc0_n (stride, roi.height);
 
   start = g_get_monotonic_time ();
 


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