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:
Pau Espin 2020-11-13 12:08:59 +01:00
parent e36be56fc8
commit 4c951adcf4
1 changed files with 1 additions and 1 deletions

View File

@ -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++;
}