author Sam Lantinga <slouken@libsdl.org>
Wed, 30 Nov 2016 22:06:05 -0800
changeset 10668 1889c850fafc
parent 10236 a9231c55e5cc
child 10952 fabcc99bb455
permissions -rw-r--r--
Fixed bug 3340 - SDL_BlitScaled causes access violation in some cases.

Simon Hug

The SDL_BlitScaled function runs into an access violation for specific blit coordinates and surface sizes. The attached testcase blits a 800x600 surface to a 1280x720 surface at the coordinates -640,-345 scaled to 1280x720. The blit function that moves the data then runs over and reads after the pixel data from the src surface causing an access violation.

I can't say where exactly it goes wrong, but I think it could have something to do with the rounding in SDL_UpperBlitScaled. final_src.y is 288 and final_src.h is 313. Together that's 601, which I believe is one too much, but I just don't know the code enough to make sure that's the problem.


I think this patch fix the issue, but maybe it's worth re-writing "SDL_UpperBlitScaled" using SDL_FRect.
     2 Bugs are now managed in the SDL bug tracker, here:
     4     https://bugzilla.libsdl.org/
     6 You may report bugs there, and search to see if a given issue has already
     7  been reported, discussed, and maybe even fixed.
    10 You may also find help on the SDL mailing list. Subscription information:
    12     http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
    14 Bug reports are welcome here, but we really appreciate if you use Bugzilla, as
    15  bugs discussed on the mailing list may be forgotten or missed.