[PATCH] D40743: Make rehash(0) work with ubsan's unsigned-integer-overflow.
Dan Albert via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Dec 1 12:30:02 PST 2017
danalbert created this revision.
Repository:
rCXX libc++
https://reviews.llvm.org/D40743
Files:
include/__hash_table
Index: include/__hash_table
===================================================================
--- include/__hash_table
+++ include/__hash_table
@@ -2136,7 +2136,7 @@
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);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40743.125193.patch
Type: text/x-patch
Size: 362 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20171201/59f94c86/attachment.bin>
More information about the cfe-commits
mailing list