shithub: mc

Download patch

ref: 512c73322d9ac6e3a6eb580e9ac0bc90b5ecc682
parent: 2f96f75f0bf5b6d0bcd957c286430db677cd5063
author: Ori Bernstein <[email protected]>
date: Tue Jul 3 17:38:59 EDT 2012

Don't walk past the end of the array.

--- a/parse/bitset.c
+++ b/parse/bitset.c
@@ -80,7 +80,7 @@
     size_t i;
 
     for (i = *elt; i < bsmax(bs); i++) {
-        while (!bs->chunks[i/Sizetbits])
+        while (i < bsmax(bs) && !bs->chunks[i/Sizetbits])
             i = (i + Sizetbits) & ~(Sizetbits - 1);
         if (bshas(bs, i)) {
             *elt = i;