From 9dbac35b1e55c49b2f1e595f4dfe3437c3fedb58 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Tue, 6 Jan 2015 18:05:49 +0100 Subject: external/harfbuzz: Work around -fsanitize=null Change-Id: I81dc29f5ba2ef442ffb7e2823f02b9bfead24a46 --- external/harfbuzz/UnpackedTarball_harfbuzz.mk | 6 ++++ external/harfbuzz/ubsan.patch | 44 +++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 external/harfbuzz/ubsan.patch (limited to 'external') diff --git a/external/harfbuzz/UnpackedTarball_harfbuzz.mk b/external/harfbuzz/UnpackedTarball_harfbuzz.mk index 0bda2a186e2a..1f9f15f355c0 100644 --- a/external/harfbuzz/UnpackedTarball_harfbuzz.mk +++ b/external/harfbuzz/UnpackedTarball_harfbuzz.mk @@ -11,4 +11,10 @@ $(eval $(call gb_UnpackedTarball_UnpackedTarball,harfbuzz)) $(eval $(call gb_UnpackedTarball_set_tarball,harfbuzz,$(HARFBUZZ_TARBALL),,harfbuzz)) +$(eval $(call gb_UnpackedTarball_set_patchlevel,harfbuzz,0)) + +$(eval $(call gb_UnpackedTarball_add_patches,harfbuzz, \ + external/harfbuzz/ubsan.patch \ +)) + # vim: set noet sw=4 ts=4: diff --git a/external/harfbuzz/ubsan.patch b/external/harfbuzz/ubsan.patch new file mode 100644 index 000000000000..3bdb589a1f66 --- /dev/null +++ b/external/harfbuzz/ubsan.patch @@ -0,0 +1,44 @@ +--- src/hb-object-private.hh ++++ src/hb-object-private.hh +@@ -131,7 +131,7 @@ + } + + inline bool destroy (void) { +- if (unlikely (!this || this->is_inert ())) ++ if (unlikely (is_inert ())) + return false; + if (ref_count.dec () != 1) + return false; +@@ -160,13 +160,12 @@ + } + + inline void trace (const char *function) const { +- if (unlikely (!this)) return; + /* TODO We cannot use DEBUG_MSG_FUNC here since that one currently only + * prints the class name and throws away the template info. */ + DEBUG_MSG (OBJECT, (void *) this, + "%s refcount=%d", + function, +- this ? ref_count.ref_count : 0); ++ ref_count.ref_count); + } + + private: +@@ -179,7 +179,7 @@ + template + static inline void hb_object_trace (const Type *obj, const char *function) + { +- obj->header.trace (function); ++ if (likely (obj)) obj->header.trace (function); + } + template + static inline Type *hb_object_create (void) +@@ -204,7 +204,7 @@ + static inline bool hb_object_destroy (Type *obj) + { + hb_object_trace (obj, HB_FUNC); +- return obj->header.destroy (); ++ return likely (obj) && obj->header.destroy (); + } + template + static inline bool hb_object_set_user_data (Type *obj, -- cgit