[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 Dec 11 20:59:47 PST 2017


danalbert added inline comments.


================
Comment at: include/__hash_table:2141
         __n = 2;
     else if (__n & (__n - 1))
         __n = __next_prime(__n);
----------------
With `rehash(0)` this is `0 & (0 - 1)`, which triggers unsigned-integer-overflow.


Repository:
  rCXX libc++

https://reviews.llvm.org/D40743





More information about the cfe-commits mailing list