Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / external / pdfium / ubsan.patch
blob1d03c28a4d156b761ce2350be27c56d303516135
1 --- core/fxcrt/string_data_template.h
2 +++ core/fxcrt/string_data_template.h
3 @@ -76,7 +76,8 @@ class StringDataTemplate {
4 ASSERT(nLen >= 0);
5 ASSERT(offset + nLen <= m_nAllocLength);
7 - memcpy(m_String + offset, pStr, nLen * sizeof(CharType));
8 + if (nLen != 0)
9 + memcpy(m_String + offset, pStr, nLen * sizeof(CharType));
10 m_String[offset + nLen] = 0;
13 --- core/fxge/cfx_glyphcache.cpp
14 +++ core/fxge/cfx_glyphcache.cpp
15 @@ -183,7 +183,8 @@ std::unique_ptr<CFX_GlyphBitmap> CFX_GlyphCache::RenderGlyph(
18 } else {
19 - memset(pDestBuf, 0, dest_pitch * bmheight);
20 + if (dest_pitch != 0 && bmheight != 0)
21 + memset(pDestBuf, 0, dest_pitch * bmheight);
22 int rowbytes = std::min(abs(src_pitch), dest_pitch);
23 for (int row = 0; row < bmheight; row++)
24 memcpy(pDestBuf + row * dest_pitch, pSrcBuf + row * src_pitch, rowbytes);