[libcxx-commits] [libcxx] [libc++] Fix possible out of range access in bitset (PR #121348)
Peng Liu via libcxx-commits
libcxx-commits at lists.llvm.org
Fri May 16 08:05:25 PDT 2025
================
@@ -283,21 +287,30 @@ inline _LIBCPP_HIDE_FROM_ABI void __bitset<_N_words, _Size>::__init(unsigned lon
template <size_t _N_words, size_t _Size>
inline _LIBCPP_CONSTEXPR __bitset<_N_words, _Size>::__bitset(unsigned long long __v) _NOEXCEPT
# ifndef _LIBCPP_CXX03_LANG
-# if __SIZEOF_SIZE_T__ == 8
- : __first_{__v}
-# elif __SIZEOF_SIZE_T__ == 4
+# if (__SIZEOF_LONG_LONG__ + __SIZEOF_SIZE_T__ - 1) / __SIZEOF_SIZE_T__ == 1
----------------
winner245 wrote:
Thanks! I've applied the suggested changes. Same below.
https://github.com/llvm/llvm-project/pull/121348
More information about the libcxx-commits
mailing list