laforge has uploaded this change for review. (
https://gerrit.osmocom.org/c/osmo-bsc/+/28058 )
Change subject: bts.c: prevent signed integer overflow in depends_on code
......................................................................
bts.c: prevent signed integer overflow in depends_on code
bts.c:818:37: runtime error: left shift of 1 by 31 places cannot be represented in type
'int'
Change-Id: Ic68e6eb11fb70bf68d3f075fe2e467aedcbfaba8
---
M src/osmo-bsc/bts.c
1 file changed, 3 insertions(+), 3 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/58/28058/1
diff --git a/src/osmo-bsc/bts.c b/src/osmo-bsc/bts.c
index 5786833..df8d93d 100644
--- a/src/osmo-bsc/bts.c
+++ b/src/osmo-bsc/bts.c
@@ -798,7 +798,7 @@
int idx, bit;
depends_calc_index_bit(dep, &idx, &bit);
- bts->depends_on[idx] |= 1 << bit;
+ bts->depends_on[idx] |= 1U << bit;
}
void bts_depend_clear(struct gsm_bts *bts, int dep)
@@ -806,7 +806,7 @@
int idx, bit;
depends_calc_index_bit(dep, &idx, &bit);
- bts->depends_on[idx] &= ~(1 << bit);
+ bts->depends_on[idx] &= ~(1U << bit);
}
int bts_depend_is_depedency(struct gsm_bts *base, struct gsm_bts *other)
@@ -815,7 +815,7 @@
depends_calc_index_bit(other->nr, &idx, &bit);
/* Check if there is a depends bit */
- return (base->depends_on[idx] & (1 << bit)) > 0;
+ return (base->depends_on[idx] & (1U << bit)) > 0;
}
static int bts_is_online(struct gsm_bts *bts)
--
To view, visit
https://gerrit.osmocom.org/c/osmo-bsc/+/28058
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Ic68e6eb11fb70bf68d3f075fe2e467aedcbfaba8
Gerrit-Change-Number: 28058
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-MessageType: newchange