Possible fix for Drascula's decodeRLE()
|Reported by:||eriktorbjorn||Owned by:||sev-|
I noticed that Valgrind complains about invalid reads in decodeRLE() several times during the Drascula intro.
I think this happens when the inner loop ends with curByte being exactly 64000. Then the outer loop is run one extra time, which is where it reads outside the source buffer.
So this patch changes the condition to see if curByte >= 64000, but then of course the we have to write to dstPtr before breaking out of the loop. Otherwise, we might miss the last byte.
This wouldn't be a safe thing to do if the output buffer could ever be 0 bytes, but we know it's always 64000 bytes. I believe this is the correct fix, but I would appreciate it if someone else could take a look, too.
(I'm going to be out of town for a few days, so if it looks right, feel free to commit it.)
Ticket imported from: #2045543. Ticket imported from: patches/1013.