Something in BitArray corrupts heap-memory?

Hi, i’m not 100% sure, but something was corrupting the heap memory while using some encryption functions.
Now i found something.

juce_BitArray.cpp was changed with revision 384.
With the old version i have no problems so far.

< return (bit >= 0 && bit <= highestBit)

return (((unsigned int) bit) <= (unsigned int) highestBit)

< if (bit >= 0 && bit <= highestBit)

if (((unsigned int) bit) <= (unsigned int) highestBit)

< if (digit >= 0 && digit < base)

        if (((unsigned int) digit) < (unsigned int) base)

Those changes just apply a very simple (but quite cunning) optimisation - it shouldn’t make any difference to how it works. I doubt if BitArray is your culprit.

…agh, no, I just thought twice about that, and of course it’s a problem, because highestBit can be negative. Doh! I’ve checked-in another version of that file now. Sorry!

Thanks, good to know you found something.
It was really hard to evaluate what was corrupting the memory

Yeah, sorry - that was a really dumb mistake. That’s the perils of using the code at the tip of SVN!