diff options
author | Dan Albert <danalbert@google.com> | 2018-01-08 21:49:12 +0000 |
---|---|---|
committer | Dan Albert <danalbert@google.com> | 2018-01-08 21:49:12 +0000 |
commit | 0802327a3931225c8837b24a788f06fbd4b2b066 (patch) | |
tree | 04c78a87a75315e0f0fd78dd90b36b2130555915 /libcxx | |
parent | 52b36918d6d762390bd2076f99d709b70f4c395f (diff) | |
download | bcm5719-llvm-0802327a3931225c8837b24a788f06fbd4b2b066.tar.gz bcm5719-llvm-0802327a3931225c8837b24a788f06fbd4b2b066.zip |
Make rehash(0) work with ubsan's unsigned-integer-overflow.
Reviewers: mclow.lists, EricWF
Reviewed By: mclow.lists
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D40743
llvm-svn: 322031
Diffstat (limited to 'libcxx')
-rw-r--r-- | libcxx/include/__hash_table | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libcxx/include/__hash_table b/libcxx/include/__hash_table index 3f430af1283..239415231f6 100644 --- a/libcxx/include/__hash_table +++ b/libcxx/include/__hash_table @@ -2136,7 +2136,7 @@ template <class _Tp, class _Hash, class _Equal, class _Alloc> void __hash_table<_Tp, _Hash, _Equal, _Alloc>::rehash(size_type __n) { - if (__n == 1) + if (__n < 2) __n = 2; else if (__n & (__n - 1)) __n = __next_prime(__n); |