We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 699

Summary: i386 inline asm version of SDL_revcpy is broken
Product: SDL Reporter: Hans de Goede <jwrdegoede>
Component: videoAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: renesd, ssallen
Version: 1.2.13Keywords: target-1.2.14
Hardware: x86   
OS: Linux   

Description Hans de Goede 2009-02-13 02:27:54 UTC
The inline asm version of SDL_revcpy sets the reverse direction flag using the std instruction, but does not clear it afterwards (it does not issue the cld instruction at the end of the inline asm). Or so I've been told, my asm isn't all that good.

This causes crashes when programs use memset after having done SDL calls which use SDL_revcpy internally. See for example of a crash caused by this:
https://bugzilla.redhat.com/show_bug.cgi?id=484121

For a detailed analysis of this crash including the conclusion that the missing "cld" is the cause see:
https://bugzilla.redhat.com/show_bug.cgi?id=484362

I've done a compile of SDL-1.2.13 with the inline version of SDL_revcpy disabled and that fixes the (reproducable) crash. I've not written a patch for this though, as I'm no good with asm.
Comment 1 Ryan C. Gordon 2009-09-13 16:33:13 UTC
Tagging this bug with "target-1.2.14" so we can try to resolve it for SDL 1.2.14.

Please note that we may choose to resolve it as WONTFIX. This tag is largely so we have a comprehensive wishlist of bugs to examine for 1.2.14 (and so we can close bugs that we'll never fix, rather than have them live forever in Bugzilla).

--ryan.
Comment 2 Patrice Mandin 2009-09-14 10:43:05 UTC
*** Bug 536 has been marked as a duplicate of this bug. ***
Comment 3 Rene Dudfield 2009-09-17 04:54:09 UTC
From the mailing list... this has been fixed.

'Fixed in svn revision #3535 for the 1.2 branch, and #3536 for the 1.3
branch!'