summaryrefslogtreecommitdiffstats
path: root/external/pdfium/ubsan.patch
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 16:51:28 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 16:51:28 +0000
commit940b4d1848e8c70ab7642901a68594e8016caffc (patch)
treeeb72f344ee6c3d9b80a7ecc079ea79e9fba8676d /external/pdfium/ubsan.patch
parentInitial commit. (diff)
downloadlibreoffice-940b4d1848e8c70ab7642901a68594e8016caffc.tar.xz
libreoffice-940b4d1848e8c70ab7642901a68594e8016caffc.zip
Adding upstream version 1:7.0.4.upstream/1%7.0.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--external/pdfium/ubsan.patch24
1 files changed, 24 insertions, 0 deletions
diff --git a/external/pdfium/ubsan.patch b/external/pdfium/ubsan.patch
new file mode 100644
index 000000000..8610e24f2
--- /dev/null
+++ b/external/pdfium/ubsan.patch
@@ -0,0 +1,24 @@
+--- core/fxcrt/string_data_template.cpp
++++ core/fxcrt/string_data_template.cpp
+@@ -82,7 +82,8 @@ void StringDataTemplate<CharType>::CopyContentsAt(size_t offset,
+ 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_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);