summaryrefslogtreecommitdiff
path: root/external/pdfium/ubsan.patch
blob: 9939b6e9e4b6762f906cbec5c3ee1a8e8ecf8f10 (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
--- core/fxcrt/string_data_template.h
+++ core/fxcrt/string_data_template.h
@@ -76,7 +76,8 @@ class StringDataTemplate {
     ASSERT(nLen >= 0);
     ASSERT(offset + nLen <= m_nAllocLength);
 
-    memcpy(m_String + offset, pStr, nLen * sizeof(CharType));
+    if (nLen != 0)
+      memcpy(m_String + offset, pStr, nLen * sizeof(CharType));
     m_String[offset + nLen] = 0;
   }
 
--- core/fxge/cfx_facecache.cpp
+++ core/fxge/cfx_facecache.cpp
@@ -183,7 +183,8 @@ std::unique_ptr<CFX_GlyphBitmap> CFX_FaceCache::RenderGlyph(
       }
     }
   } else {
-    memset(pDestBuf, 0, dest_pitch * bmheight);
+    if (dest_pitch != 0 && bmheight != 0)
+      memset(pDestBuf, 0, dest_pitch * bmheight);
     int rowbytes = std::min(abs(src_pitch), dest_pitch);
     for (int row = 0; row < bmheight; row++)
       memcpy(pDestBuf + row * dest_pitch, pSrcBuf + row * src_pitch, rowbytes);