laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/31952 )
Change subject: tests/v110: assert(user_data_chunk_bits) in test_ra1()
......................................................................
tests/v110: assert(user_data_chunk_bits) in test_ra1()
Coverity warns that osmo_v110_sync_ra1_get_user_data_chunk_bitlen() may
return a negative value, which is used as loop boundary. Even though
this is unlikely, let's add an assert().
Change-Id: I0fc0e0bac74bd96351030432ef1b140b727acb0d
Fixes: CID#310968
---
M tests/v110/test_ra1.c
1 file changed, 18 insertions(+), 1 deletion(-)
Approvals:
Jenkins Builder: Verified
pespin: Looks good to me, approved
laforge: Looks good to me, approved
diff --git a/tests/v110/test_ra1.c b/tests/v110/test_ra1.c
index 775ec4b..48db553 100644
--- a/tests/v110/test_ra1.c
+++ b/tests/v110/test_ra1.c
@@ -10,7 +10,7 @@
static void test_ra1(enum osmo_v100_sync_ra1_rate rate)
{
int user_rate = osmo_v110_sync_ra1_get_user_data_rate(rate);
- int user_data_chunk_bits = osmo_v110_sync_ra1_get_user_data_chunk_bitlen(rate);
+ int user_data_chunk_bits;
struct osmo_v110_decoded_frame fr;
ubit_t user_bits[48];
ubit_t bits[80];
@@ -19,6 +19,9 @@
printf("\n======= User data rate %u\n", user_rate);
+ user_data_chunk_bits = osmo_v110_sync_ra1_get_user_data_chunk_bitlen(rate);
+ OSMO_ASSERT(user_data_chunk_bits >= 0);
+
/* we abuse the fact that ubit_t is 8bit so we can actually
* store integer values to clearly identify which bit ends up where */
memset(user_bits, 0xFE, sizeof(user_bits));
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/31952
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I0fc0e0bac74bd96351030432ef1b140b727acb0d
Gerrit-Change-Number: 31952
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged