[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Another blitting surface to itself crash



I just used svn to get the info.... looks like Marcus had them fix this in rev.3535 on february 4th...!

good job Marcus, you fixed this 6.5 months ago!

I guess we just need this in pygame now... (I like the idea of a 1.8.2 that uses a custom patched SDL 1.2.13 for the windows installer....)

svn output follows....


> svn log http://svn.libsdl.org/branches/SDL-1.2/include/SDL_stdinc.h
------------------------------------------------------------------------
r3535 | icculus | 2008-02-04 09:22:56 -0800 (Mon, 04 Feb 2008) | 22 lines

Date: Sat, 2 Feb 2008 22:08:05 +0100
From: Marcus von Appen
To: sdl@xxxxxxxxxxxxxxxx
Subject: [SDL] [Patch] SDL-1.2 SDL_revcpy() asm patch for the cld flag

Hi,

as reported through the FreeBSD bug tracking system in SDL 1.2.13 (and
in the 1.2 branch, if I see that correctly) the SDL_revcpy() macro sets
the direction flag (std), but does not clear it afterwards (cld), which
is wrong according to the GCC and SYS V specs.  This can cause some
weird side effects, which in turn can lead to memory corruption.

You can read the full report with a detailed description and test
program at http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/120052

Attached is the submitted patch, which fixes the issue.

Regards
Marcus

----------------------------------------------------------------------------------------------
<other revisions follow....>


On Tue, Aug 19, 2008 at 4:37 PM, Lenard Lindstrom <len-l@xxxxxxxxx> wrote:
Hi Brian,

Well that answers the question when it was fixed. The libsdl SVN viewer is down at the moment so I can't get the message associated with the bug fix. I can't find the associated bug entry in the SDL bug tracker. I would like to know if it was a known issue or just something someone noticed while doing something else. If it had been reported and I had thought to look for it in the bug tracker it could have saved a lot of time.

Lenard


Brian Fisher wrote:
to confirm, looks like it is fixed in SDL 1.2 SVN:
http://svn.libsdl.org/branches/SDL-1.2/include/SDL_stdinc.h

somebody added a cld after the rep movsl

however it is definitely _not_ fixed in 1.2.13 though (you can see from the source archive: http://libsdl.org/release/SDL-1.2.13.zip ) , meaning it won't be fixed until SDL 1.2.14 is released..

On Tue, Aug 19, 2008 at 2:24 PM, Lenard Lindstrom <len-l@xxxxxxxxx <mailto:len-l@xxxxxxxxx>> wrote:

   I believe I found the bug. And it was already fixed for SDL 1.3 (I
   cannot confirm it is also fixed for 1.2.13 in SVN since the site
   is down.) There should be a licensing requirement to do assembly
   level programming :-). The optimized reverse blit uses an i386
   string move instruction. The direction of the copy is controlled
   by a register flag. A cleared flag causes a forward copy, the data
   pointers are incremented. A set flag causes a reverse copy,
   decrementing data pointers. The flag was set by the SDL copy code,
   but not cleared afterwards. And the flag doesn't reset itself
   apparently. So the set flag sat there like an armed bomb until the
   next string copy instruction was executed.

   Lenard



   Lenard Lindstrom wrote:


       That seems to be it. Try out the modified SDL.dll for Pythons
       2.4. and 2.5:

       http://www3.telus.net/len_l/pygame/SDL-self-blit.zip

       md5sum:
       59a283f9383d6b5512c236d98e39c97b *SDL-self-blit.zip

       Lenard


       Lenard Lindstrom wrote:


           I will. But it will be hand-customized.

           Lenard


           Brian Fisher wrote:

               Hey Lenard,
               Can you build SDL with mingw in a way that the inlined
               assembly won't be used? (i.e. so that it uses the same
               source that VisualC does to build)