SDL/src
Sam Lantinga 36998b823e Fixed bug 3689 - MMX YUV renderer crash
felix

The functions in src/render/SDL_yuv_mmx.c contain the following inline assembly snippet:

        /* tap dance to workaround the inability to use %%ebx at will... */
        /*  move one thing to the stack... */
        "pushl $0\n"  /* save a slot on the stack. */
        "pushl %%ebx\n"  /* save %%ebx. */
        "movl %0, %%ebx\n"  /* put the thing in ebx. */
        "movl %%ebx,4(%%esp)\n"  /* put the thing in the stack slot. */
        "popl %%ebx\n"  /* get back %%ebx (the PIC register). */

Here's how it ended up in a binary on my old laptop:

   0xb5c17dbd <ColorRGBDitherYV12MMX1X+93>:	push   $0x0
   0xb5c17dbf <ColorRGBDitherYV12MMX1X+95>:	push   %ebx
   0xb5c17dc0 <ColorRGBDitherYV12MMX1X+96>:	mov    0xc(%esp),%ebx
   0xb5c17dc4 <ColorRGBDitherYV12MMX1X+100>:	mov    %ebx,0x4(%esp)
   0xb5c17dc8 <ColorRGBDitherYV12MMX1X+104>:	pop    %ebx

Apparently the compiler, oblivious to the fact that the assembly snippet manipulates the %esp register, decided to refer to the operand via that same register instead of via %ebp (I believe -fomit-frame-pointer enables this). This causes %ebx to be loaded with the wrong value, which later leads to a null pointer dereference.

Recent GCC can use the %ebx register normally: <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47602#c16>. There is even an explicit constraint "b" for allocating it.
2017-07-20 10:48:57 -07:00
..
atomic atomic: Patched to compile on Android. 2017-04-13 15:28:56 -04:00
audio Fixed bug 3705 - Add capture support to the sndio backend 2017-07-20 10:39:47 -07:00
core Fixed bug 3609 - Windows build fails due to conflicting types for 'XINPUT_GAMEPAD_EX' 2017-07-10 18:31:28 -07:00
cpuinfo Fixed compile error with gcc -std=c99 2017-03-06 21:25:06 -08:00
dynapi Support for QNX 7.0 (thanks, Elad!). 2017-07-01 17:50:47 -04:00
events Fixed bug 3703 - Missing media keys support on Amazon Fire TV remote control 2017-07-20 10:46:38 -07:00
file Updated copyright for 2017 2017-01-01 18:33:28 -08:00
filesystem haiku: Fixed missing slash in path from SDL_GetPrefPath(). 2017-06-17 22:30:09 +02:00
haptic xinput: use the full range of the haptic motors (thanks, Trent!). 2017-06-21 01:22:00 -04:00
joystick Added support for an XBox One wired controller for Leo L?nnenm?ki 2017-07-11 19:27:50 -07:00
libm Updated copyright for 2017 2017-01-01 18:33:28 -08:00
loadso Updated copyright for 2017 2017-01-01 18:33:28 -08:00
main haiku: Fixed compiling without OpenGL support. 2017-07-07 23:00:22 +02:00
power power: whoops, that should be "==" not "!=". 2017-07-03 16:45:12 -04:00
render Fixed bug 3689 - MMX YUV renderer crash 2017-07-20 10:48:57 -07:00
stdlib Fixed whitespace code style. 2017-05-29 00:51:38 -04:00
test test: info now reports usable display bounds and DPI (thanks, Eric!). 2017-05-18 16:29:10 -04:00
thread windows: Change the default on SDL_HINT_WINDOWS_DISABLE_THREAD_NAMING. 2017-06-06 13:12:43 -04:00
timer Updated copyright for 2017 2017-01-01 18:33:28 -08:00
video Fixed bug 3703 - Missing media keys support on Amazon Fire TV remote control 2017-07-20 10:46:38 -07:00
SDL.c Backing out broken change from previous commit. 2017-04-01 00:46:42 -04:00
SDL_assert.c assert: Better Emscripten support. 2017-05-19 14:51:03 -04:00
SDL_assert_c.h Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_dataqueue.c Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_dataqueue.h Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_error.c Fixed bug 3696 - SDL_ShowMessageBox displays different error from intended 2017-07-10 17:16:12 -07:00
SDL_error_c.h Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_hints.c Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_internal.h Some patches to make SDL compile with armcc (ARM's C compiler). 2017-03-02 13:33:04 -05:00
SDL_log.c Updated copyright for 2017 2017-01-01 18:33:28 -08:00