summaryrefslogtreecommitdiff
path: root/external/pdfium/ubsan.patch
blob: 27ec578ca321aa6b1d6d7f4d98657f2ea8abc01c (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
--- core/fxge/ge/cfx_facecache.cpp
+++ core/fxge/ge/cfx_facecache.cpp
@@ -205,7 +205,8 @@
       }
     }
   } else {
-    FXSYS_memset(pDestBuf, 0, dest_pitch * bmheight);
+    if (dest_pitch != 0 && bmheight != 0)
+        FXSYS_memset(pDestBuf, 0, dest_pitch * bmheight);
     if (anti_alias == FXFT_RENDER_MODE_MONO &&
         FXFT_Get_Bitmap_PixelMode(FXFT_Get_Glyph_Bitmap(m_Face)) ==
             FXFT_PIXEL_MODE_MONO) {
--- third_party/agg23/agg_rasterizer_scanline_aa.h
+++ third_party/agg23/agg_rasterizer_scanline_aa.h
@@ -349,14 +349,14 @@
                     cover += cur_cell->cover;
                 }
                 if(area) {
-                    alpha = calculate_alpha((cover << (poly_base_shift + 1)) - area, no_smooth);
+                    alpha = calculate_alpha(int(unsigned(cover) << (poly_base_shift + 1)) - area, no_smooth);
                     if(alpha) {
                         sl.add_cell(x, alpha);
                     }
                     x++;
                 }
                 if(num_cells && cur_cell->x > x) {
-                    alpha = calculate_alpha(cover << (poly_base_shift + 1), no_smooth);
+                    alpha = calculate_alpha(unsigned(cover) << (poly_base_shift + 1), no_smooth);
                     if(alpha) {
                         sl.add_span(x, cur_cell->x - x, alpha);
                     }