Change in osmo-bts[master]: measurement.c: fix integer overflow problem

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/.

dexter gerrit-no-reply at lists.osmocom.org
Mon Nov 2 18:05:40 UTC 2020


dexter has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bts/+/20979 )

Change subject: measurement.c: fix integer overflow problem
......................................................................

measurement.c: fix integer overflow problem

The variables num_meas_sub_expect - num_meas_sub must not be subtracted
without prior checking. Depending on the input (which might be
errornous), num_meas_sub might be greater then num_meas_sub_expect. This
eventually leads into odd behavior, which can be difficult to debug.

Change-Id: I381cc637d1c125f279ccf88db114609946fe24fe
Related: OS#4799
---
M src/common/measurement.c
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  Jenkins Builder: Verified
  pespin: Looks good to me, but someone else must approve
  laforge: Looks good to me, approved



diff --git a/src/common/measurement.c b/src/common/measurement.c
index d5c3ee0..3813658 100644
--- a/src/common/measurement.c
+++ b/src/common/measurement.c
@@ -642,7 +642,7 @@
 			 * negotiated in AMR, so we can not know if and how many
 			 * SUB frames are missing. */
 			if (lchan->tch_mode != GSM48_CMODE_SPEECH_AMR) {
-				if (num_ul_meas_expect - i <= num_meas_sub_expect - num_meas_sub) {
+				if (num_meas_sub <= i) {
 					num_meas_sub_subst++;
 					is_sub = true;
 				}

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

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I381cc637d1c125f279ccf88db114609946fe24fe
Gerrit-Change-Number: 20979
Gerrit-PatchSet: 2
Gerrit-Owner: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201102/f02edb5f/attachment.htm>


More information about the gerrit-log mailing list