diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2017-05-17 16:37:33 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2017-05-18 09:07:15 +0300 |
commit | a436e349dfd0035b2b861ee772b47089043f5a2a (patch) | |
tree | 2985e295137f4056ff8cbfcc27959516cca9c10d /storage/xtradb/ibuf | |
parent | 9f57e595b49744e3c1920f8c46a2ec8e7fc5fd66 (diff) | |
download | mariadb-git-a436e349dfd0035b2b861ee772b47089043f5a2a.tar.gz |
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.
Diffstat (limited to 'storage/xtradb/ibuf')
-rw-r--r-- | storage/xtradb/ibuf/ibuf0ibuf.cc | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/storage/xtradb/ibuf/ibuf0ibuf.cc b/storage/xtradb/ibuf/ibuf0ibuf.cc index e00adefe68f..414d7fc39be 100644 --- a/storage/xtradb/ibuf/ibuf0ibuf.cc +++ b/storage/xtradb/ibuf/ibuf0ibuf.cc @@ -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) { |