--- ray/src/cal/cnt.c 2022/04/21 02:52:40 1.6 +++ ray/src/cal/cnt.c 2022/04/22 15:50:34 1.7 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: cnt.c,v 1.6 2022/04/21 02:52:40 greg Exp $"; +static const char RCSid[] = "$Id: cnt.c,v 1.7 2022/04/22 15:50:34 greg Exp $"; #endif /* * cnt.c - simple counting program. @@ -161,9 +161,11 @@ incr_counter(uby8 *ctrp, int n) { n = tree_br[n].cntr_siz; - while (n-- > 0) /* LSB first */ - if (++(*ctrp++)) - break; + while (++(*ctrp++)) /* LSB first */ + if (--n <= 0) { + fputs("Shuffle occupancy overflow!\n", stderr); + exit(1); /* means we sized something wrong */ + } }