diff --git a/media/libstagefright/foundation/include/media/stagefright/foundation/AData.h b/media/libstagefright/foundation/include/media/stagefright/foundation/AData.h index c6c12ff5c2..87cf58b54a 100644 --- a/media/libstagefright/foundation/include/media/stagefright/foundation/AData.h +++ b/media/libstagefright/foundation/include/media/stagefright/foundation/AData.h @@ -28,6 +28,10 @@ #undef HIDE #define HIDE __attribute__((visibility("hidden"))) +// The internals of AUnion cause problems with CFI +#undef NO_CFI +#define NO_CFI __attribute__((no_sanitize("cfi"))) + namespace android { /** @@ -93,7 +97,7 @@ struct HIDE _AUnion_impl { * \param args arbitrary arguments for constructor */ template - inline static void emplace(size_t totalSize, T *addr, Args&&... args) { + inline static void NO_CFI emplace(size_t totalSize, T *addr, Args&&... args) { new(addr)T(std::forward(args)...); // clear slack space - this is not technically required constexpr size_t size = sizeof(T); @@ -160,7 +164,7 @@ public: template< typename T, typename ...Args, typename=typename std::enable_if::value>::type> - inline void emplace(Args&&... args) { + inline void NO_CFI emplace(Args&&... args) { _AUnion_impl::emplace( sizeof(_type), reinterpret_cast(&mValue), std::forward(args)...); }