summaryrefslogtreecommitdiff
path: root/external/poppler/ubsan.patch.0
blob: 623858da9f1fa2246044a1f21269e69b060f931a (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
--- goo/GooString.cc
+++ goo/GooString.cc
@@ -161,7 +161,7 @@
       // assert(s != s1) the roundedSize condition ensures this
       if (newLength < length) {
 	memcpy(s1, s, newLength);
-      } else {
+      } else if (length != 0) {
 	memcpy(s1, s, length);
       }
       if (s != sStatic)
--- poppler/Stream.cc
+++ poppler/Stream.cc
@@ -2966,12 +2966,12 @@
       } else {
 	amp = 0;
       }
-      data[0] += (*prevDC += amp) << scanInfo.al;
+      data[0] += (int) ((unsigned) (*prevDC += amp) << scanInfo.al);
     } else {
       if ((bit = readBit()) == 9999) {
 	return gFalse;
       }
-      data[0] += bit << scanInfo.al;
+      data[0] += (unsigned) bit << scanInfo.al;
     }
     ++i;
   }
@@ -3064,7 +3064,7 @@
 	  j = dctZigZag[i++];
 	}
       }
-      data[j] = amp << scanInfo.al;
+      data[j] = (unsigned) amp << scanInfo.al;
     }
   }
 
@@ -3251,8 +3251,8 @@
     v3 = p[6];
     v4 = (dctSqrt1d2 * (p[1] - p[7]) + 128) >> 8;
     v7 = (dctSqrt1d2 * (p[1] + p[7]) + 128) >> 8;
-    v5 = p[3] << 4;
-    v6 = p[5] << 4;
+    v5 = (unsigned) p[3] << 4;
+    v6 = (unsigned) p[5] << 4;
 
     // stage 3
     t = (v0 - v1+ 1) >> 1;
--- poppler/XRef.cc
+++ poppler/XRef.cc
@@ -293,6 +293,7 @@
   xRefStream = gFalse;
   scannedSpecialFlags = gFalse;
   encrypted = gFalse;
+  encAlgorithm = cryptRC4;
   permFlags = defPermFlags;
   ownerPasswordOk = gFalse;
   rootNum = -1;