summaryrefslogtreecommitdiff
blob: b9c39ad7206dfe3677bc7095b8b015c39513ee7f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
From f90483245250456d6306b4fff2f68f445ef33864 Mon Sep 17 00:00:00 2001
From: RyuzakiKK <aasonykk@gmail.com>
Date: Sat, 5 Aug 2017 20:00:30 +0200
Subject: [PATCH] Avoid integer overflow

pinpoint is affected by a possible integer overflow, that was also
found and patched upstream in gtk+
https://git.gnome.org/browse/gtk+/commit/?id=894b1ae76a32720f4bb3d39cf460402e3ce331d6

With g_malloc_m we can avoid the integer overflow.

As pointed out by Pacho Ramos in
https://bugzilla.gnome.org/show_bug.cgi?id=762029
---
 pp-cairo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pp-cairo.c b/pp-cairo.c
index 8afb362..dc0a452 100644
--- a/pp-cairo.c
+++ b/pp-cairo.c
@@ -120,7 +120,7 @@ _cairo_new_surface_from_pixbuf (const GdkPixbuf *pixbuf)
     format = CAIRO_FORMAT_ARGB32;
 
   cairo_stride = cairo_format_stride_for_width (format, width);
-  cairo_pixels = g_malloc (height * cairo_stride);
+  cairo_pixels = g_malloc_n (height, cairo_stride);
   surface = cairo_image_surface_create_for_data ((unsigned char *)cairo_pixels,
                                                  format,
                                                  width, height, cairo_stride);
-- 
2.13.4