Change in libosmocore[master]: bitvec: Fix left shifting out of range on signed variable

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

pespin gerrit-no-reply at lists.osmocom.org
Fri Nov 13 11:10:54 UTC 2020


pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/21135 )


Change subject: bitvec: Fix left shifting out of range on signed variable
......................................................................

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
---
M src/bitvec.c
1 file changed, 1 insertion(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/35/21135/1

diff --git a/src/bitvec.c b/src/bitvec.c
index d7f32fb..2b4e8c9 100644
--- a/src/bitvec.c
+++ b/src/bitvec.c
@@ -272,7 +272,7 @@
 		if (bit < 0)
 			return bit;
 		if (bit)
-			ui |= (1 << (num_bits - i - 1));
+			ui |= ((unsigned)1 << (num_bits - i - 1));
 		bv->cur_bit++;
 	}
 

-- 
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/21135
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I70502044d05c0505a4b65c1e12e89ff657afe804
Gerrit-Change-Number: 21135
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201113/0dcb1784/attachment.htm>


More information about the gerrit-log mailing list