summaryrefslogtreecommitdiff
path: root/external/libvisio
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2015-12-24 12:26:29 +0100
committerStephan Bergmann <sbergman@redhat.com>2015-12-24 12:26:54 +0100
commit171393c7a497690b3c2a8614a6250ca9e3bf676d (patch)
tree01ecdcbadb70cb8e435b433825282776db1e0cb0 /external/libvisio
parent6536150492b8f59af3385afbab7792082f1b45dd (diff)
external/libvisio: Avoid undefined behavior
Change-Id: I454cf3b102986f2e3c1905f5fe0e1b2bb427828e
Diffstat (limited to 'external/libvisio')
-rw-r--r--external/libvisio/UnpackedTarball_libvisio.mk4
-rw-r--r--external/libvisio/ubsan.patch10
2 files changed, 14 insertions, 0 deletions
diff --git a/external/libvisio/UnpackedTarball_libvisio.mk b/external/libvisio/UnpackedTarball_libvisio.mk
index f9467c531296..aa8b48fb40b9 100644
--- a/external/libvisio/UnpackedTarball_libvisio.mk
+++ b/external/libvisio/UnpackedTarball_libvisio.mk
@@ -13,6 +13,10 @@ $(eval $(call gb_UnpackedTarball_set_tarball,libvisio,$(VISIO_TARBALL)))
$(eval $(call gb_UnpackedTarball_set_patchlevel,libvisio,0))
+$(eval $(call gb_UnpackedTarball_add_patches,libvisio, \
+ external/libvisio/ubsan.patch \
+))
+
ifeq ($(COM_IS_CLANG),TRUE)
ifneq ($(filter -fsanitize=%,$(CC)),)
$(eval $(call gb_UnpackedTarball_add_patches,libvisio, \
diff --git a/external/libvisio/ubsan.patch b/external/libvisio/ubsan.patch
new file mode 100644
index 000000000000..d80f7ebe5bbe
--- /dev/null
+++ b/external/libvisio/ubsan.patch
@@ -0,0 +1,10 @@
+--- src/lib/VSDContentCollector.cpp
++++ src/lib/VSDContentCollector.cpp
+@@ -3285,6 +3285,7 @@
+ _handleLevelChange(level);
+ librevenge::RVNGString text;
+ std::vector<unsigned char> tmpData(layerMem.m_data.size());
++ if (!layerMem.m_data.empty())
+ memcpy(&tmpData[0], layerMem.m_data.getDataBuffer(), layerMem.m_data.size());
+ appendCharacters(text, tmpData, layerMem.m_format);
+