8333887: ubsan: unsafe.cpp:247:13: runtime error: store to null pointer of type 'volatile int'

Reviewed-by: lucy, mdoerr
This commit is contained in:
Matthias Baesken 2024-06-13 14:02:01 +00:00
parent 9d8439c107
commit 0d3a3771c3

View File

@ -242,6 +242,11 @@ public:
return normalize_for_read(*addr());
}
// we use this method at some places for writing to 0 e.g. to cause a crash;
// ubsan does not know that this is the desired behavior
#if defined(__clang__) || defined(__GNUC__)
__attribute__((no_sanitize("undefined")))
#endif
void put(T x) {
GuardUnsafeAccess guard(_thread);
*addr() = normalize_for_write(x);