From 738cc467ee0a033a32bf2cfd02152f21082823ee Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Mon, 20 Mar 2017 21:38:52 -0300 Subject: [PATCH] Fixing occasional MMDVMHost crash when receiving P25 RF data with high BER (RS decoder fix) --- RS241213.cpp | 5 +++-- RS241213.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/RS241213.cpp b/RS241213.cpp index d4a9814..3e929d0 100644 --- a/RS241213.cpp +++ b/RS241213.cpp @@ -241,7 +241,7 @@ bool CRS241213::decode(unsigned char* data) if (q == 0) { //it is a root //store root (index-form) and error location number root[count] = i; - locn[count] = i - 1; + locn[count] = i - 40; //if wehave max possible roots, abort search to save time count = count + 1; @@ -317,7 +317,8 @@ bool CRS241213::decode(unsigned char* data) // apply error to data if (num1 != 0) { - HB[locn[j]] = HB[locn[j]] ^ (rsGFexp[(rsGFlog[num1] + rsGFlog[num2] + 63 - rsGFlog[den]) % 63]); + if(locn[j] < 24) + HB[locn[j]] = HB[locn[j]] ^ (rsGFexp[(rsGFlog[num1] + rsGFlog[num2] + 63 - rsGFlog[den]) % 63]); } } diff --git a/RS241213.h b/RS241213.h index 523e06a..fe3171a 100644 --- a/RS241213.h +++ b/RS241213.h @@ -17,7 +17,7 @@ */ #if !defined(RS241213_H) -#define RS241213 +#define RS241213_H class CRS241213 {