pitrou commented on code in PR #44468:
URL: https://github.com/apache/arrow/pull/44468#discussion_r1806686950
##########
cpp/src/arrow/util/ubsan.h:
##########
@@ -63,7 +63,7 @@ inline std::enable_if_t<std::is_trivially_copyable_v<T>, T>
SafeLoadAs(
template <typename T>
inline std::enable_if_t<std::is_trivially_copyable_v<T>, T> SafeLoad(const T*
unaligned) {
std::remove_const_t<T> ret;
- std::memcpy(&ret, unaligned, sizeof(T));
+ std::memcpy(&ret, reinterpret_cast<const void*>(unaligned), sizeof(T));
Review Comment:
Hmm, the doc for `std::launder` says:
> Devirtualization fence with respect to p. Returns a pointer to the same
memory that p points to, but where the referent object is assumed to have a
distinct lifetime and dynamic type.
Does the "distinct lifetime" imply that ASAN wouldn't be able to detect
use-after-free?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]