Ryujinx-SDL/src/video/windows
Sam Lantinga 79a846d486 Fixed bug 3334 - SDL_ShowMessageBox uses wrong index and accesses un-allocated memory
romain.lacroix

For the windows implementation of SDL_ShowMessageBox() : ./src/video/windows/SDL_windowsmessagebox.c:345 WIN_ShowMessageBox()

The implementation in 2.0.4 uses "button index" for parameter "id" of function AddDialogButton().

It then expects the value provided in param wParam of function MessageBoxDialogProc() to be a valid index of a button.

It uses this value to index in the array of buttons when DialogBoxIndirect() returns (line 474 : *buttonid = buttons[which].buttonid;)

However, when dismissing this box with Escape, the return value of DialogBoxIndirect will be SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT (=2) which is not always a valid index of array buttons.

When the array buttons has a length less or equal than 2, the memory access is invalid; I can see that the value written to *buttonId is uninitialized memory (random value).

The fix I propose : use value "buttonid" (field of button) for parameter "id" of AddDialogButton(), then copy return value of DialogBoxIndirect() in *buttonid. This way, we will not use an out-of-bounds index in array buttons.
2017-08-11 19:42:39 -07:00
..
SDL_msctf.h Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_vkeys.h Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_windowsclipboard.c Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_windowsclipboard.h Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_windowsevents.c Fixed bug 3701 - WM_TOUCH message may cause calls to null if touch functions are not properly loaded 2017-08-09 20:26:16 -07:00
SDL_windowsevents.h Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_windowsframebuffer.c Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_windowsframebuffer.h Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_windowskeyboard.c Fixed bug 3702 - Clear error messages of SDL_LoadObject for optional libraries 2017-08-11 10:21:19 -07:00
SDL_windowskeyboard.h Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_windowsmessagebox.c Fixed bug 3334 - SDL_ShowMessageBox uses wrong index and accesses un-allocated memory 2017-08-11 19:42:39 -07:00
SDL_windowsmessagebox.h Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_windowsmodes.c Fixed bug 3714 - Windows: SDL_WINDOW_FULLSCREEN_DESKTOP broken on 3 monitor setup w/ DPI scaling 2017-08-11 10:18:45 -07:00
SDL_windowsmodes.h Fixed bug 3714 - Windows: SDL_WINDOW_FULLSCREEN_DESKTOP broken on 3 monitor setup w/ DPI scaling 2017-08-11 10:18:45 -07:00
SDL_windowsmouse.c Removed redundant mouse clean up on quit for some platforms. 2017-05-19 23:30:59 +02:00
SDL_windowsmouse.h Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_windowsopengl.c Fixed bugs 2570, 3145, improved OpenGL ES context support on Windows and X11 2017-01-10 08:54:33 -08:00
SDL_windowsopengl.h Fixed bugs 2570, 3145, improved OpenGL ES context support on Windows and X11 2017-01-10 08:54:33 -08:00
SDL_windowsopengles.c Fixed bug 3690 - SDL2 KMS/DRM render context support 2017-08-02 10:22:48 -07:00
SDL_windowsopengles.h Fixed bug 3100 - SetSwapInterval should now be enabled for ANGLE/EGL 2017-01-09 10:10:33 -08:00
SDL_windowsshape.c windows: Changed six internal functions to be static. 2017-04-29 22:50:35 +02:00
SDL_windowsshape.h Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_windowsvideo.c Fixed bug 3702 - Clear error messages of SDL_LoadObject for optional libraries 2017-08-11 10:21:19 -07:00
SDL_windowsvideo.h Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_windowswindow.c Get the parent of non-SDL-created windows, for completeness 2017-06-16 11:14:08 -07:00
SDL_windowswindow.h Clean up parent window when destroying a window 2017-06-16 10:50:29 -07:00
wmmsg.h Updated copyright for 2017 2017-01-01 18:33:28 -08:00