1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Cast properly for shift operand

`(int) << RHASH_LEV_SHIFT` can be negative integer.
This commit is contained in:
Koichi Sasada 2020-03-09 02:53:46 +09:00
parent daa04c5562
commit dff69bb462

2
hash.c
View file

@ -1434,7 +1434,7 @@ hash_iter_lev_inc(VALUE hash)
}
else {
lev += 1;
RBASIC(hash)->flags = ((RBASIC(hash)->flags & ~RHASH_LEV_MASK) | (lev << RHASH_LEV_SHIFT));
RBASIC(hash)->flags = ((RBASIC(hash)->flags & ~RHASH_LEV_MASK) | ((VALUE)lev << RHASH_LEV_SHIFT));
if (lev == RHASH_LEV_MAX) {
iter_lev_in_ivar_set(hash, lev);
}