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/.
Harald Welte gerrit-no-reply at lists.osmocom.orgHarald Welte has submitted this change and it was merged.
Change subject: test_gsm0808_enc_dec_speech_codec_with_cfg: initialize properly
......................................................................
test_gsm0808_enc_dec_speech_codec_with_cfg: initialize properly
The uninitialized members of enc_sc sporadically hit address sanitizer failure
during gsm0808_test, like:
../../../../src/libosmocore/src/gsm/gsm0808_utils.c:187:8: runtime error: load of value 13, which is not a valid value for type '_Bool'
../../../../src/libosmocore/src/gsm/gsm0808_utils.c:191:8: runtime error: load of value 119, which is not a valid value for type '_Bool'
How the test survived so long is a mystery to me; as soon as some uninitialized
members would by coincidence not be zero, the test should always have failed at
OSMO_ASSERT(memcmp(&enc_sc, &dec_sc, sizeof(enc_sc)) == 0).
Related: OS#3148
Change-Id: Iaa20c59f624fbdc69a018cabd0f7e9c5a1389519
---
M tests/gsm0808/gsm0808_test.c
1 file changed, 7 insertions(+), 7 deletions(-)
Approvals:
Harald Welte: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/tests/gsm0808/gsm0808_test.c b/tests/gsm0808/gsm0808_test.c
index a9ab72b..49673fe 100644
--- a/tests/gsm0808/gsm0808_test.c
+++ b/tests/gsm0808/gsm0808_test.c
@@ -595,16 +595,16 @@
static void test_gsm0808_enc_dec_speech_codec_with_cfg()
{
- struct gsm0808_speech_codec enc_sc;
- struct gsm0808_speech_codec dec_sc;
+ struct gsm0808_speech_codec enc_sc = {
+ .pi = true,
+ .tf = true,
+ .type = GSM0808_SCT_FR3,
+ .cfg = 0xabcd,
+ };
+ struct gsm0808_speech_codec dec_sc = {};
struct msgb *msg;
uint8_t rc_enc;
int rc_dec;
-
- enc_sc.pi = true;
- enc_sc.tf = true;
- enc_sc.type = GSM0808_SCT_FR3;
- enc_sc.cfg = 0xabcd;
msg = msgb_alloc(1024, "output buffer");
rc_enc = gsm0808_enc_speech_codec(msg, &enc_sc);
--
To view, visit https://gerrit.osmocom.org/7815
To unsubscribe, visit https://gerrit.osmocom.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Iaa20c59f624fbdc69a018cabd0f7e9c5a1389519
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder