-
Notifications
You must be signed in to change notification settings - Fork 140
Repair Error
shm0nya edited this page Jan 20, 2020
·
3 revisions
Hi. In my project, at the University, I used this library. When analyzing the code, I found an error.
File dmtxreedsol.c
Func static DmtxBoolean RsFindErrorLocatorPoly(DmtxByteList *elpOut, const DmtxByteList *syn, int errorWordCount, int maxCorrectable)
... /* Calculate error location polynomial elp[i] (set 1st term) */ for(lambda = elp[m].length - 1, j = 0; j <= lambda; j++) elp[iNext].b[j+i-m] = antilog301[(NN - log301[dis.b[m]] + log301[dis.b[i]] + log301[elp[m].b[j]]) % NN]; ...
There should be an additional check for 0 here My code is
for(lambda = elp[m].length - 1, j = 0; j <= lambda; j++) elp[iNext].b[j+i-m] = elp[i - 1][j] == 0 ? 0 : antilog301[(NN - log301[dis.b[m]] + log301[dis.b[i]] + log301[elp[m].b[j]]) % NN];