summaryrefslogtreecommitdiff
path: root/external/cairo/pixman/pixman-ubsan.patch
blob: 3a556d19a9dd6acdea96f6cd54f414f6a5466885 (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
diff -ru pixman-0.40.0.orig/pixman/pixman-bits-image.c pixman-0.40.0/pixman/pixman-bits-image.c
--- misc/pixman-0.40.0.orig/pixman/pixman-bits-image.c	2021-08-29 20:02:33.714515016 +0100
+++ misc/build/pixman-0.40.0/pixman/pixman-bits-image.c	2021-08-29 20:05:43.304930185 +0100
@@ -351,8 +351,8 @@
      * positioned relative to a particular phase (and not relative to whatever
      * exact fraction we happen to get here).
      */
-    x = ((x >> x_phase_shift) << x_phase_shift) + ((1 << x_phase_shift) >> 1);
-    y = ((y >> y_phase_shift) << y_phase_shift) + ((1 << y_phase_shift) >> 1);
+    x = ((uint32_t)(x >> x_phase_shift) << x_phase_shift) + ((1 << x_phase_shift) >> 1);
+    y = ((uint32_t)(y >> y_phase_shift) << y_phase_shift) + ((1 << y_phase_shift) >> 1);
 
     px = (x & 0xffff) >> x_phase_shift;
     py = (y & 0xffff) >> y_phase_shift;
diff -ru pixman-0.40.0.orig/pixman/pixman-combine32.c pixman-0.40.0/pixman/pixman-combine32.c
--- misc/pixman-0.40.0.orig/pixman/pixman-combine32.c	2021-08-29 20:02:33.715514970 +0100
+++ misc/build/pixman-0.40.0/pixman/pixman-combine32.c	2021-08-29 20:05:43.304930185 +0100
@@ -589,7 +589,7 @@
 	    rg = DIV_ONE_UN8 (rg);					\
 	    rb = DIV_ONE_UN8 (rb);					\
 									\
-	    *(dest + i) = ra << 24 | rr << 16 | rg << 8 | rb;		\
+	    *(dest + i) = (uint32_t)ra << 24 | rr << 16 | rg << 8 | rb;		\
 	}								\
     }									\
     									\
diff -ru pixman-0.40.0.orig/pixman/pixman-fast-path.c pixman-0.40.0/pixman/pixman-fast-path.c
--- misc/pixman-0.40.0.orig/pixman/pixman-fast-path.c	2021-08-29 20:02:33.716514925 +0100
+++ misc/build/pixman-0.40.0/pixman/pixman-fast-path.c	2021-08-29 20:05:43.303930231 +0100
@@ -2758,8 +2758,8 @@
 	 * positioned relative to a particular phase (and not relative to whatever
 	 * exact fraction we happen to get here).
 	 */
-	x = ((vx >> x_phase_shift) << x_phase_shift) + ((1 << x_phase_shift) >> 1);
-	y = ((vy >> y_phase_shift) << y_phase_shift) + ((1 << y_phase_shift) >> 1);
+	x = ((uint32_t)(vx >> x_phase_shift) << x_phase_shift) + ((1 << x_phase_shift) >> 1);
+	y = ((uint32_t)(vy >> y_phase_shift) << y_phase_shift) + ((1 << y_phase_shift) >> 1);
 
 	px = (x & 0xffff) >> x_phase_shift;
 	py = (y & 0xffff) >> y_phase_shift;
@@ -2836,7 +2836,7 @@
 	sgtot = CLIP (sgtot, 0, 0xff);
 	sbtot = CLIP (sbtot, 0, 0xff);
 
-	buffer[k] = (satot << 24) | (srtot << 16) | (sgtot << 8) | (sbtot << 0);
+	buffer[k] = ((uint32_t)satot << 24) | (srtot << 16) | (sgtot << 8) | (sbtot << 0);
 
     next:
 	vx += ux;
diff -ru pixman-0.40.0.orig/pixman/pixman-sse2.c pixman-0.40.0/pixman/pixman-sse2.c
--- misc/pixman-0.40.0.orig/pixman/pixman-sse2.c	2021-08-29 20:02:33.716514925 +0100
+++ misc/build/pixman-0.40.0/pixman/pixman-sse2.c	2021-08-29 20:05:43.306930095 +0100
@@ -3344,7 +3344,7 @@
 
 	b = filler & 0xff;
 	w = (b << 8) | b;
-	filler = (w << 16) | w;
+	filler = ((uint32_t)w << 16) | w;
     }
     else if (bpp == 16)
     {
diff -ru pixman-0.40.0.orig/pixman/pixman-utils.c pixman-0.40.0/pixman/pixman-utils.c
--- misc/pixman-0.40.0.orig/pixman/pixman-utils.c	2021-08-29 20:02:33.715514970 +0100
+++ misc/build/pixman-0.40.0/pixman/pixman-utils.c	2021-08-29 20:05:43.306930095 +0100
@@ -213,7 +213,7 @@
 	g = float_to_unorm (src[i].g, 8);
 	b = float_to_unorm (src[i].b, 8);
 
-	dst[i] = (a << 24) | (r << 16) | (g << 8) | (b << 0);
+	dst[i] = ((uint32_t)a << 24) | (r << 16) | (g << 8) | (b << 0);
     }
 }