office-gobmx/external/pdfium/ubsan.patch
Miklos Vajna 7707339a7d external: update pdfium to 4568
Change-Id: I2bfd5f806281e747702d423b7e59b5f88a7bea9c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118868
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2021-07-14 10:53:33 +02:00

24 lines
939 B
Diff

--- core/fxcrt/string_data_template.cpp
+++ core/fxcrt/string_data_template.cpp
@@ -82,7 +82,8 @@ void StringDataTemplate<CharType>::CopyContentsAt(size_t offset,
DCHECK_GE(offset, 0);
DCHECK_GE(nLen, 0);
DCHECK_LE(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_glyphcache.cpp
+++ core/fxge/cfx_glyphcache.cpp
@@ -183,7 +183,8 @@ std::unique_ptr<CFX_GlyphBitmap> CFX_GlyphCache::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);