diff --git a/backend/reedsol.c b/backend/reedsol.c index 53b4e565..b1610800 100644 --- a/backend/reedsol.c +++ b/backend/reedsol.c @@ -49,7 +49,7 @@ // size. #include // only needed for debug (main) -#include // only needed for malloc/free +#include #include "reedsol.h" static int logmod; // 2**symsize - 1 static int rlen; @@ -75,6 +75,11 @@ void rs_init_gf(const int poly) { b >>= 1; m--; + // Ensure m not negative to supress gcc -Walloc-size-larger-than + if (m < 0) { + m = 0; + } + // Calculate the log/alog tables logmod = (1 << m) - 1; logt = (int *) malloc(sizeof (int) * (logmod + 1));