[ scummvm-Patches-2045543 ] Possible fix for Drascula's decodeRLE()

SourceForge.net noreply at sourceforge.net
Sun Aug 10 21:55:51 CEST 2008


Patches item #2045543, was opened at 2008-08-10 21:55
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=418822&aid=2045543&group_id=37116

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Torbjrn Andersson (eriktorbjorn)
Assigned to: Eugene Sandulenko (sev)
Summary: Possible fix for Drascula's decodeRLE()

Initial Comment:
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.)

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=418822&aid=2045543&group_id=37116




More information about the Scummvm-tracker mailing list