ibuf_get_volume_buffered_hash(): Use a proper type cast

On 64-bit systems, the constant 1 would be 32-bit (int or unsigned)
by default. Cast the constant to ulint before shifting to avoid a
-fsanitize=undefined warning or any potential overflow.
This commit is contained in:
Marko Mäkelä 2017-05-17 16:37:33 +03:00
parent 9f57e595b4
commit a436e349df
2 changed files with 2 additions and 4 deletions

View File

@ -2895,8 +2895,7 @@ ibuf_get_volume_buffered_hash(
fold = ut_fold_binary(data, len);
hash += (fold / (CHAR_BIT * sizeof *hash)) % size;
bitmask = static_cast<ulint>(
1 << (fold % (CHAR_BIT * sizeof(*hash))));
bitmask = static_cast<ulint>(1) << (fold % (CHAR_BIT * sizeof(*hash)));
if (*hash & bitmask) {

View File

@ -2935,8 +2935,7 @@ ibuf_get_volume_buffered_hash(
fold = ut_fold_binary(data, len);
hash += (fold / (CHAR_BIT * sizeof *hash)) % size;
bitmask = static_cast<ulint>(
1 << (fold % (CHAR_BIT * sizeof(*hash))));
bitmask = static_cast<ulint>(1) << (fold % (CHAR_BIT * sizeof(*hash)));
if (*hash & bitmask) {