[SDL] [patch/rfc] fix segfault in SDL_CalculateBlitN() introduced by altivec code

Mike Frysinger vapier at gentoo.org
Thu Dec 29 20:29:28 PST 2005


with libsdl-1.2.9, some games (like bomberclone) started segfaulting in 
Gentoo ... with the help of Aaron in the Gentoo bugzilla, we traced it back 
to this change:
http://www.libsdl.org/cgi/cvsweb.cgi/SDL12/src/video/SDL_blit_N.c.diff?r1=1.9&r2=1.10

the last change in the last hunk:
-(table[which].cpu_mmx == SDL_HasMMX())
+(table[which].blit_features & GetBlitFeatures()) == 
table[which].blit_features)

the bug seems to be that on non-altivec systems, if blit_features is 0, this
statement returns true when it used to return false

(table[which].cpu_mmx == SDL_HasMMX()))
           0          ==        1
(table[which].blit_features & GetBlitFeatures()) == 
table[which].blit_features)
             (0    &     1)             ==         0

if i change the statement to read:
(table[which].blit_features & GetBlitFeatures()) == GetBlitFeatures()

bomberclone no longer segfaults on my box

can anyone else confirm this ?

Gentoo bug report:
http://bugs.gentoo.org/104533
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libsdl-1.2.9-sdl-blit-mmx-check.patch
Type: text/x-diff
Size: 551 bytes
Desc: not available
Url : http://twomix.devolution.com/pipermail/sdl/attachments/20051229/1d5ffbc6/libsdl-1.2.9-sdl-blit-mmx-check.bin


More information about the SDL mailing list