[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
Mon Jan 8 13:50:30 PST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rCXX322031: Make rehash(0) work with ubsan's unsigned-integer-overflow. (authored by danalbert, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D40743?vs=125193&id=128979#toc

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.128979.patch
Type: text/x-patch
Size: 362 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180108/7cb1f833/attachment.bin>


More information about the cfe-commits mailing list