Skip to content
This repository was archived by the owner on Mar 22, 2023. It is now read-only.

Commit ac1f733

Browse files
Merge pull request #1115 from igchor/ubsan_1.11
[stable-1.11] Ubsan fix
2 parents 2153423 + 90c9428 commit ac1f733

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

include/libpmemobj++/detail/self_relative_ptr_base_impl.hpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-License-Identifier: BSD-3-Clause
2-
/* Copyright 2020, Intel Corporation */
2+
/* Copyright 2020-2021, Intel Corporation */
33

44
/**
55
* @file
@@ -222,9 +222,8 @@ class self_relative_ptr_base_impl {
222222
*/
223223
uintptr_t mask = other_offset == nullptr_offset;
224224
--mask;
225-
uintptr_t ptr = reinterpret_cast<uintptr_t>(
226-
reinterpret_cast<const_byte_ptr_type>(this) +
227-
other_offset + 1);
225+
uintptr_t ptr = static_cast<uintptr_t>(
226+
reinterpret_cast<intptr_t>(this) + other_offset + 1);
228227
ptr &= mask;
229228
return reinterpret_cast<void *>(ptr);
230229
}

0 commit comments

Comments
 (0)