diff options
author | Vasil Velichkov <vvvelichkov@gmail.com> | 2018-03-27 21:08:00 +0300 |
---|---|---|
committer | Piotr Krysik <ptrkrysik@gmail.com> | 2018-04-06 15:18:26 +0200 |
commit | 924d1873da666476a23f3a9f988401eb122870f7 (patch) | |
tree | 31f5c60400a5bdc28c5f7c9b16944ca6776fcc13 | |
parent | a39610029400908502caf075d39a2ec1d20e56a6 (diff) |
Fix an assert in ViterbiR2O4::decode
The table length was wrong becuase matchCostTable is a float pointer and
not an array since 792330777d7c21df02ce1ecb6f876b076a14b519
python2.7: /home/user/gr-gsm/lib/decoding/openbts/ViterbiR204.cpp:288: virtual void ViterbiR2O4::decode(const SoftVector&, BitVector&): Assertion `match-matchCostTable<(float)sizeof(matchCostTable)/sizeof(matchCostTable[0])-1' failed.
(gdb) f 4
#4 0x00007fffdff820c3 in ViterbiR2O4::decode (this=0x5555563bbdf0, in=..., target=...)
at /home/vasko/sources/gr-gsm/gr-gsm/lib/decoding/openbts/ViterbiR204.cpp:288
288 assert(match-matchCostTable<(float)sizeof(matchCostTable)/sizeof(matchCostTable[0])-1);
(gdb) p match-matchCostTable
$1 = 2
(gdb) p (float)sizeof(matchCostTable)/sizeof(matchCostTable[0])-1
$2 = 1
(gdb) p (float)sizeof(matchCostTable)/sizeof(matchCostTable[0])
$3 = 2
(gdb) p sizeof(matchCostTable)
$4 = 8
-rw-r--r-- | lib/decoding/openbts/ViterbiR204.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/decoding/openbts/ViterbiR204.cpp b/lib/decoding/openbts/ViterbiR204.cpp index fe31aad..29a46e8 100644 --- a/lib/decoding/openbts/ViterbiR204.cpp +++ b/lib/decoding/openbts/ViterbiR204.cpp @@ -285,8 +285,8 @@ void ViterbiR2O4::decode(const SoftVector &in, BitVector& target) const ViterbiR2O4::vCand *minCost = NULL; while (op<opt) { // Viterbi algorithm - assert(match-matchCostTable<(float)sizeof(matchCostTable)/sizeof(matchCostTable[0])-1); - assert(mismatch-mismatchCostTable<(float)sizeof(mismatchCostTable)/sizeof(mismatchCostTable[0])-1); + assert(match - matchCostTable < ctsz - 1); + assert(mismatch - mismatchCostTable < ctsz - 1); minCost = decoder.vstep(*ip, match, mismatch, oCount < oSize); ip += step; match += step; |