summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--external/breakpad/UnpackedTarball_breakpad.mk10
-rw-r--r--external/breakpad/ubsan.patch21
2 files changed, 31 insertions, 0 deletions
diff --git a/external/breakpad/UnpackedTarball_breakpad.mk b/external/breakpad/UnpackedTarball_breakpad.mk
index 445047bc7d87..108004ddee36 100644
--- a/external/breakpad/UnpackedTarball_breakpad.mk
+++ b/external/breakpad/UnpackedTarball_breakpad.mk
@@ -9,6 +9,8 @@
$(eval $(call gb_UnpackedTarball_UnpackedTarball,breakpad))
+$(eval $(call gb_UnpackedTarball_set_patchlevel,breakpad,0))
+
$(eval $(call gb_UnpackedTarball_set_tarball,breakpad,$(BREAKPAD_TARBALL)))
$(eval $(call gb_UnpackedTarball_add_patches,breakpad,\
@@ -18,4 +20,12 @@ $(eval $(call gb_UnpackedTarball_add_patches,breakpad,\
external/breakpad/breakpad-stackwalk.patch.1 \
))
+ifeq ($(COM_IS_CLANG),TRUE)
+ifneq ($(filter -fsanitize=%,$(CC)),)
+$(eval $(call gb_UnpackedTarball_add_patches,breakpad, \
+ external/breakpad/ubsan.patch \
+))
+endif
+endif
+
# vim: set noet sw=4 ts=4:
diff --git a/external/breakpad/ubsan.patch b/external/breakpad/ubsan.patch
new file mode 100644
index 000000000000..f4204516eed4
--- /dev/null
+++ b/external/breakpad/ubsan.patch
@@ -0,0 +1,21 @@
+--- src/client/linux/minidump_writer/directory_reader.h
++++ src/client/linux/minidump_writer/directory_reader.h
+@@ -96,7 +96,7 @@
+ const int fd_;
+ bool hit_eof_;
+ unsigned buf_used_;
+- uint8_t buf_[sizeof(struct kernel_dirent) + NAME_MAX + 1];
++ uint8_t buf_[sizeof(struct kernel_dirent) + NAME_MAX + 1] __attribute__ ((aligned (__BIGGEST_ALIGNMENT__)));
+ };
+
+ } // namespace google_breakpad
+--- src/common/memory.h
++++ src/common/memory.h
+@@ -75,6 +75,7 @@
+ if (!bytes)
+ return NULL;
+
++ bytes = (bytes + (__BIGGEST_ALIGNMENT__ - 1)) & ~(__BIGGEST_ALIGNMENT__ - 1);
+ if (current_page_ && page_size_ - page_offset_ >= bytes) {
+ uint8_t *const ret = current_page_ + page_offset_;
+ page_offset_ += bytes;