summaryrefslogtreecommitdiffstats
path: root/external/cairo/pixman/pixman-ubsan.patch
blob: 583706ae1764c1726431e443e4b2add1a09fc941 (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
--- misc/pixman/pixman/pixman.h
+++ misc/build/pixman/pixman/pixman.h
@@ -127,7 +127,7 @@
 #define pixman_fixed_1_minus_e		(pixman_fixed_1 - pixman_fixed_e)
 #define pixman_fixed_minus_1		(pixman_int_to_fixed(-1))
 #define pixman_fixed_to_int(f)		((int) ((f) >> 16))
-#define pixman_int_to_fixed(i)		((pixman_fixed_t) ((i) << 16))
+#define pixman_int_to_fixed(i)		((pixman_fixed_t) ((i) * (1 << 16)))
 #define pixman_fixed_to_double(f)	(double) ((f) / (double) pixman_fixed_1)
 #define pixman_double_to_fixed(d)	((pixman_fixed_t) ((d) * 65536.0))
 #define pixman_fixed_frac(f)		((f) & pixman_fixed_1_minus_e)
--- misc/pixman/pixman/pixman-fast-path.c
+++ misc/build/pixman/pixman/pixman-fast-path.c
@@ -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;
--- misc/pixman/pixman/pixman-bits-image.c
+++ misc/build/pixman/pixman/pixman-bits-image.c
@@ -306,7 +306,7 @@
     sgtot = CLIP (sgtot, 0, 0xff);
     sbtot = CLIP (sbtot, 0, 0xff);
 
-    return ((satot << 24) | (srtot << 16) | (sgtot <<  8) | (sbtot));
+    return (((uint32_t)satot << 24) | (srtot << 16) | (sgtot <<  8) | (sbtot));
 }
 
 static force_inline uint32_t