Commit a436e349 authored by Marko Mäkelä's avatar Marko Mäkelä

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.
parent 9f57e595
......@@ -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) {
......
......@@ -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) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment