mirror of https://gerrit.osmocom.org/libosmocore
bitvec: Fix left shifting out of range on signed variable
Fixes following ASan runtime errors spotted by TypeTest osmo-pcu unit test: libosmocore/src/bitvec.c:275:13: runtime error: left shift of 1 by 31 places cannot be represented in type 'int' Change-Id: I70502044d05c0505a4b65c1e12e89ff657afe804
This commit is contained in:
parent
e36be56fc8
commit
4c951adcf4
|
@ -272,7 +272,7 @@ int bitvec_get_uint(struct bitvec *bv, unsigned int num_bits)
|
|||
if (bit < 0)
|
||||
return bit;
|
||||
if (bit)
|
||||
ui |= (1 << (num_bits - i - 1));
|
||||
ui |= ((unsigned)1 << (num_bits - i - 1));
|
||||
bv->cur_bit++;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue