Commit d71b7361 authored by Ilya Maykov's avatar Ilya Maykov Committed by Facebook Github Bot

fix UBSAN failure in atomic_shared_ptr_test

Summary: Fix UBSAN failure in atomic_shared_ptr_test by using reinterpret_cast instead of static_cast.

Reviewed By: yfeldblum

Differential Revision: D5314116

fbshipit-source-id: 8479c9c4bdeeb155067a3de75efe4e97c36519e5
parent efcacd1c
......@@ -68,8 +68,8 @@ class shared_ptr_internals {
return (T*)inplace;
}
// Could also be a _Sp_counted_deleter, but the layout is the same
auto ptr =
static_cast<std::_Sp_counted_ptr<const void*, std::_S_atomic>*>(base);
using derived_type = std::_Sp_counted_ptr<const void*, std::_S_atomic>;
auto ptr = reinterpret_cast<derived_type*>(base);
return (T*)(ptr->*fieldPtr(access_counted_ptr_ptr{}));
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment