Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/10097 )

Change subject: Make viterbi decoder deterministic in case of bit errors / too 
few symbols
......................................................................

Make viterbi decoder deterministic in case of bit errors / too few symbols

Running tetra-rx on a capture with lots of bit errors is not
deterministic. Investigation with Valgrind shows various errors about
uninitialised values in libosmocore's viterbi decoder.

The cause appears to lie in @lower_mac/viterbi.c@. The only function
there allocates space for 864 symbols and then fills it with the symbols
received. However, sym_count is sometimes less than 864, leaving the
rest of the array uninitialized.

Initializing it with @int8_t vit_inp[864*4] = {0};@ fixes the problem.

Change-Id: Ib745c387e21fb81afef69efcf7e46d5d49331c8f
Fixes: OS#3410
---
M src/lower_mac/viterbi.c
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/src/lower_mac/viterbi.c b/src/lower_mac/viterbi.c
index 86aff77..b6f12c1 100644
--- a/src/lower_mac/viterbi.c
+++ b/src/lower_mac/viterbi.c
@@ -5,7 +5,7 @@

 void viterbi_dec_sb1_wrapper(const uint8_t *in, uint8_t *out, unsigned int 
sym_count)
 {
-       int8_t vit_inp[864*4];
+       int8_t vit_inp[864*4] = {0};
        int i;

        for (i = 0; i < sym_count*4; i++) {

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

Gerrit-Project: osmo-tetra
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ib745c387e21fb81afef69efcf7e46d5d49331c8f
Gerrit-Change-Number: 10097
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte <[email protected]>
Gerrit-Reviewer: Harald Welte <[email protected]>
Gerrit-Reviewer: Jenkins Builder

Reply via email to