Suppress UBSAN false positive
Similar to the previous CFI suppression, this cast is valid because
we cast to type T before T is constructed, but we never actually
use T in this cast.
It should be valid because use of the cast pointer only occurs
after construction is complete.
Fix failures in
https://ci.chromium.org/ui/p/chromium/builders/ci/linux-ubsan-vptr/29687/overview
Bug: chromium:40195122
Change-Id: I7fe1d16fe0a3fb3f630a9f65af2f2096e2fd562c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/185964
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
diff --git a/src/dawn/common/WeakRefSupport.h b/src/dawn/common/WeakRefSupport.h
index b318fc5..d1f15c7 100644
--- a/src/dawn/common/WeakRefSupport.h
+++ b/src/dawn/common/WeakRefSupport.h
@@ -78,10 +78,11 @@
class WeakRefSupport : public detail::WeakRefSupportBase {
public:
#if DAWN_COMPILER_IS(CLANG)
- // Note that the static cast below fails CFI builds due to the cast. The cast itself is
+ // Note that the static cast below fails CFI/UBSAN builds due to the cast. The cast itself is
// safe so we suppress the failure. See the following link regarding the cast:
// https://stackoverflow.com/questions/73172193/can-you-static-cast-this-to-a-derived-class-in-a-base-class-constructor-then-u,
DAWN_NO_SANITIZE("cfi-derived-cast")
+ DAWN_NO_SANITIZE("vptr")
#endif
WeakRefSupport()
: WeakRefSupportBase(AcquireRef(new detail::WeakRefData(static_cast<T*>(this)))) {}