summaryrefslogtreecommitdiff
blob: 273956ea402edb4e505b7e00721853ea44cd05aa (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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
From 2fb6bce8b3fdae67b8cdd93f253dad3743fc01b8 Mon Sep 17 00:00:00 2001
From: Mike Gorse <mgorse@suse.com>
Date: Tue, 6 Oct 2015 11:46:24 -0500
Subject: [PATCH] pixops: use gint64 in more places to avoid overflow when
 shifting

---
 gdk-pixbuf/pixops/pixops.c | 34 +++++++++++++++++-----------------
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/gdk-pixbuf/pixops/pixops.c b/gdk-pixbuf/pixops/pixops.c
index b0abecd..6a4a096 100644
--- a/gdk-pixbuf/pixops/pixops.c
+++ b/gdk-pixbuf/pixops/pixops.c
@@ -354,11 +354,11 @@ pixops_composite_nearest (guchar        *dest_buf,
 			  double         scale_y,
 			  int            overall_alpha)
 {
-  int i;
-  int x;
-  int x_step = (1 << SCALE_SHIFT) / scale_x;
-  int y_step = (1 << SCALE_SHIFT) / scale_y;
-  int xmax, xstart, xstop, x_pos, y_pos;
+  gint64 i;
+  gint64 x;
+  gint64 x_step = (1 << SCALE_SHIFT) / scale_x;
+  gint64 y_step = (1 << SCALE_SHIFT) / scale_y;
+  gint64 xmax, xstart, xstop, x_pos, y_pos;
   const guchar *p;
   unsigned int  a0;
 
@@ -524,13 +524,13 @@ pixops_composite_color_nearest (guchar        *dest_buf,
 				guint32        color1,
 				guint32        color2)
 {
-  int i, j;
-  int x;
-  int x_step = (1 << SCALE_SHIFT) / scale_x;
-  int y_step = (1 << SCALE_SHIFT) / scale_y;
+  gint64 i, j;
+  gint64 x;
+  gint64 x_step = (1 << SCALE_SHIFT) / scale_x;
+  gint64 y_step = (1 << SCALE_SHIFT) / scale_y;
   int r1, g1, b1, r2, g2, b2;
   int check_shift = get_check_shift (check_size);
-  int xmax, xstart, xstop, x_pos, y_pos;
+  gint64 xmax, xstart, xstop, x_pos, y_pos;
   const guchar *p;
   unsigned int  a0;
 
@@ -1338,20 +1338,20 @@ pixops_process (guchar         *dest_buf,
 		PixopsLineFunc  line_func,
 		PixopsPixelFunc pixel_func)
 {
-  int i, j;
-  int x, y;			/* X and Y position in source (fixed_point) */
+  gint64 i, j;
+  gint64 x, y;			/* X and Y position in source (fixed_point) */
 
   guchar **line_bufs;
   int *filter_weights;
 
-  int x_step;
-  int y_step;
+  gint64 x_step;
+  gint64 y_step;
 
   int check_shift;
-  int scaled_x_offset;
+  gint64 scaled_x_offset;
 
-  int run_end_x;
-  int run_end_index;
+  gint64 run_end_x;
+  gint64 run_end_index;
 
   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) */
-- 
2.6.1