sdl2_frt/src/video/x11
Sam Lantinga fb835f9e3b Fixed bug 2330 - Debian bug report: SDL2 X11 driver buffer overflow with large X11 file descriptor
manuel.montezelo

Original bug report (note that it was against 2.0.0, it might have been fixed in between):  http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=733015

--------------------------------------------------------
Package: libsdl2-2.0-0
Version: 2.0.0+dfsg1-3
Severity: normal
Tags: patch

I have occasional crashes here caused by the X11 backend of SDL2. It seems to
be caused by the X11_Pending function trying to add a high number (> 1024)
file descriptor to a fd_set before doing a select on it to avoid busy waiting
on X11 events. This causes a buffer overflow because the file descriptor is
larger (or equal) than the limit FD_SETSIZE.

Attached is a possible workaround patch.

Please also keep in mind that fd_set are also used in following files which
may have similar problems.

src/audio/bsd/SDL_bsdaudio.c
src/audio/paudio/SDL_paudio.c
src/audio/qsa/SDL_qsa_audio.c
src/audio/sun/SDL_sunaudio.c
src/joystick/linux/SDL_sysjoystick.c


--------------------------------------------------------

On Tuesday 24 December 2013 00:43:13 Sven Eckelmann wrote:
> I have occasional crashes here caused by the X11 backend of SDL2. It seems
> to be caused by the X11_Pending function trying to add a high number (>
> 1024) file descriptor to a fd_set before doing a select on it to avoid busy
> waiting on X11 events. This causes a buffer overflow because the file
> descriptor is larger (or equal) than the limit FD_SETSIZE.


I personally experienced this problem while hacking on the python bindings
package for SDL2 [1] (while doing make runtest). But it easier to reproduce in
a smaller, synthetic testcase.
2017-08-14 20:22:19 -07:00
..
edid-parse.c Fixed edid parsing code for older gcc compilers 2016-12-12 09:18:42 -08:00
edid.h Fixed edid parsing code for older gcc compilers 2016-12-12 09:18:42 -08:00
imKStoUCS.c x11: Updated imKStoUCS.* to latest from x.org. 2016-02-08 01:08:21 -05:00
imKStoUCS.h x11: Updated imKStoUCS.* to latest from x.org. 2016-02-08 01:08:21 -05:00
SDL_x11clipboard.c x11: Make a separate unmapped window to own clipboard selections. 2017-07-31 13:49:22 -04:00
SDL_x11clipboard.h Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_x11dyn.c Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_x11dyn.h Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_x11events.c Fixed bug 2330 - Debian bug report: SDL2 X11 driver buffer overflow with large X11 file descriptor 2017-08-14 20:22:19 -07:00
SDL_x11events.h Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_x11framebuffer.c Fixed bug 1859 - No SDL_VIDEORESIZE event generated when the window manager sets the window size. 2017-04-03 13:32:53 -07:00
SDL_x11framebuffer.h Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_x11keyboard.c Changed messages about not recognized keys to include discourse link. 2017-05-26 22:45:52 +02:00
SDL_x11keyboard.h Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_x11messagebox.c x11: Patched to compile. 2017-08-13 01:00:01 -04:00
SDL_x11messagebox.h Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_x11modes.c Fixed bug 3722 - Fall back to xinerama/xvidmode if xrandr modes initialization fails 2017-08-02 10:28:13 -07:00
SDL_x11modes.h Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_x11mouse.c Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_x11mouse.h Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_x11opengl.c Removed newlines from error messages. 2017-03-26 21:00:19 +02:00
SDL_x11opengl.h Fixed comment 2017-01-13 11:37:12 -08:00
SDL_x11opengles.c Fixed bug 3690 - SDL2 KMS/DRM render context support 2017-08-02 10:22:48 -07:00
SDL_x11opengles.h Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_x11shape.c Removed unused internal window shape functions. 2017-05-25 23:00:43 +02:00
SDL_x11shape.h Removed unused internal window shape functions. 2017-05-25 23:00:43 +02:00
SDL_x11sym.h Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_x11touch.c Fixed bug 3583 - X11 touch device can be permanently lost 2017-02-11 11:14:48 -08:00
SDL_x11touch.h Fixed bug 3583 - X11 touch device can be permanently lost 2017-02-11 11:14:48 -08:00
SDL_x11video.c Fixed bug 3742 - minor warning fixes 2017-08-13 21:16:58 -07:00
SDL_x11video.h x11: Make a separate unmapped window to own clipboard selections. 2017-07-31 13:49:22 -04:00
SDL_x11window.c Fixed bug 2500 - X11: SDL tries (and fails) to hide foreign windows 2017-08-14 10:28:47 -07:00
SDL_x11window.h Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_x11xinput2.c Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_x11xinput2.h Updated copyright for 2017 2017-01-01 18:33:28 -08:00