⏳🛡 Pythonic universal errors-and-erasures Reed-Solomon codec to protect your data from errors and bitrot. Includes a future-proof zero-dependencies pure-python implementation 🔮 and an optional speed-optimized Cython/C extension 🚀
In the file reedsolo.py at line 499: magnitude = gf_div(y, err_loc_prime)
this will divide by zero if err_loc_prime is zero.
You should add a check for err_loc_prime == 0
like this:
y = gf_poly_eval(err_eval[::-1], Xi_inv) # numerator of the Forney algorithm (errata evaluator evaluated)
y = gf_mul(gf_pow(Xi, 1), y)
if err_loc_prime == 0:raise ReedSolomonError("Could not find error magnitude")
# Compute the magnitude
magnitude = gf_div(y, err_loc_prime) # magnitude value of the error, calculated by the Forney algorithm (an equation in fact): dividing the errata evaluator with the errata locator derivative gives us the errata magnitude (ie, value to repair) the ith symbol
E[err_pos[i]] = magnitude # store the magnitude for this error into the magnitude polynomial
In the file reedsolo.py at line 499: magnitude = gf_div(y, err_loc_prime)
this will divide by zero if err_loc_prime is zero.
You should add a check for err_loc_prime == 0
like this: