Patch: SDL_SoftStretch segfault fix

Hi. When SDL_SoftStretch assembly code is enabled, SDL doesn’t make
the code it generates executable, which results in a segfault on some
machines when calling that code. The attached patch (against SDL
1.2.12) fixes this by using mprotect to make the copy_rows buffer
executable. This also requires the buffer to be page-aligned.

Unfortunately the patch is a bit posix-specific though, as I don’t know
the right way to do this in Windows etc (does it have mprotect?), so
the patch probably needs some tweaking before it can be committed.

Hi. When SDL_SoftStretch assembly code is enabled, SDL doesn’t make
the code it generates executable, which results in a segfault on some
machines when calling that code. The attached patch (against SDL
1.2.12) fixes this by using mprotect to make the copy_rows buffer
executable. This also requires the buffer to be page-aligned.

Unfortunately the patch is a bit posix-specific though, as I don’t know
the right way to do this in Windows etc (does it have mprotect?), so
the patch probably needs some tweaking before it can be committed.

laugh I just did exactly this to fix the issue on OpenBSD.

Is it a problem on other unices?

-Sam Lantinga, Lead Software Engineer, Blizzard Entertainment

I made this a more general fix for systems that support mprotect().

Thanks!
-Sam Lantinga, Lead Software Engineer, Blizzard Entertainment