Had some nightmares doing bit manipulation in Python. That was fun, for some definition of fun.
I accidentally read two bytes as signed instead of unsigned, then bitshifted them to get a relative offset for RLE decoding. This meant that the result was the correct length but completely wrong contents.
Also, for some reason it seemed to gravitate towards the octet 0xBA, filling lots of places with it for no apparent reason.
That was the entire morning of staring at the code and vbindiff.