diff --git a/src/util_m4ri.h b/src/util_m4ri.h index afcfb16..173ca1d 100644 --- a/src/util_m4ri.h +++ b/src/util_m4ri.h @@ -214,6 +214,7 @@ static inline int nextelement(const word * const set1, const int m, const int po } else{ w = SETWD(pos); + if (w >= m) return -1; setwd = set1[w] & (m4ri_ffff<< SETBT(pos)); } for (;;){ diff --git a/src/utils.c b/src/utils.c index 60388b9..156b7a4 100644 --- a/src/utils.c +++ b/src/utils.c @@ -77,7 +77,7 @@ FILE * nzlist_r_open(const char fnam[], long long int *lineno){ #else /* treat signature line as comment */ *lineno=1; #endif - char c=fgetc(f); /** are there comments to skip? */ // putchar(c); + int c=fgetc(f); /** are there comments to skip? */ // putchar(c); while(c=='%'){ /** `comment line` starting with '%' */ do{ c=fgetc(f); // putchar(c); @@ -106,7 +106,7 @@ one_vec_t * nzlist_r_one(FILE *f, one_vec_t * vec, const char fnam[], long long return NULL; /** not an actuall error */ int w; - char c=fgetc(f); /** are there comments to skip? */ + int c=fgetc(f); /** are there comments to skip? */ while(c=='%'){ /** `comment line` starting with '%' */ do{ c=fgetc(f);