Commit graph

50 commits

Author SHA1 Message Date
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
Sam Lantinga f8de064c0a Added wchar.h to fix build on some platforms with new wcs* functions 2017-08-13 22:26:44 -07:00
Sam Lantinga f1829d956f Added SDL_wcscmp() 2017-08-13 20:37:49 -07:00
Sam Lantinga 75d5f34398 Forgot to add function check for fopen64 to CMake build 2017-08-11 21:17:10 -07:00
Ryan C. Gordon 73c6cebb80 cmake: Pacify warning about Policy CMP0042 not being set. 2017-08-09 22:43:16 -04:00
Sam Lantinga 496337b3cf Fixed bug 3651 - CMake build does not install CMake package configuration
tschwinger@elitemail.org

Most ironically, although autoconf/automake-based builds install (pretty half-assed) CMake package configuration files, they're missing in installations resulting from CMake-based builds entirely.

A proper configuration file typically also loads target exports (implemented in patch 3572, also fixing this issue - see my comment on that issue for details).

I believe it would be best to let the dinosaurs go extinct and redirect all build efforts to the CMake end for two reasons:

1. It potentially provides the best user experience, but you'd have to give it some love and ship with less quirky buildfiles.

2. It would force distros to build SDL via CMake and thus would ensure target exports are actually available everywhere.

Various CMake patches I submitted today in summary (directly converted from the HG commits and `am`d onto a fork of a git mirror that happened to be on `tip`).

    https://github.com/tschw/SDL/commits/patched

Fixing #2576 #3572, #3613, and this fresh ticket, which is almost entirely advertisement ;).

These already do to make SDL much less of a quirky fella to have in your dependency tree...
2017-08-09 19:03:10 -07:00
Olli Kallioinen 2b5a5c510b Android build fixes
-Enabling checking for GCC_ATOMICS also on clang by default. This way all Android ABIs build successfully
 -Android cmake: Threading was not enabled correctly
 -Android cmake: Timers and dynamic lib loading were not included in the sources
2017-06-08 22:07:55 +03:00
Sam Lantinga 56363ebf61 Fixed bug 3690 - SDL2 KMS/DRM render context support
Manuel

The attached patch adds support for KMS/DRM context graphics.

It builds with no problem on X86_64 GNU/Linux systems, provided the needed libraries are present, and on ARM GNU/Linux systems that have KMS/DRM support and a GLES2 implementation.
Tested on Raspberry Pi: KMS/DRM is what the Raspberry Pi will use as default in the near future, once the propietary DispmanX API by Broadcom is overtaken by open graphics stack, it's possible to boot current Raspbian system in KMS mode by adding "dtoverlay=vc4-kms-v3d" to config.txt on Raspbian's boot partition.
X86 systems use KMS right away in every current GNU/Linux system.

Simple build instructions:

$./autogen.sh
$./configure --enable-video-kmsdrm
$make
2017-08-02 10:22:48 -07:00
Sam Lantinga 3c09265daf Fixed bug 3609 - Windows build fails due to conflicting types for 'XINPUT_GAMEPAD_EX'
Ozkan Sezer

(In reply to Ryan C. Gordon from comment #9)
> I've put this patch in as https://hg.libsdl.org/SDL/rev/7213ae46e870 ...can
> you verify this works on the latest MinGW?
>
> Thanks,
> --ryan.


This patch is wrong: the structure in question has nothing to do with any
gcc version in use.  I suggest reverting this adding a conigury check for
it, instead.  Something like the following should do it: (configure needs
regenerating.)
2017-07-10 18:31:28 -07:00
Sam Lantinga c1cd93e562 Fixed bug 3670 - CMake IOS haptic error 2017-06-12 16:35:34 -07:00
Ryan C. Gordon e5f4a71f1a cmake: iOS haptic section was referencing power source code (thanks, Martin!).
Fixes Bugzilla #3670.
2017-06-11 16:00:45 -04:00
Ryan C. Gordon d9039f2396 jack: Initial shot at a JACK audio target.
http://jackaudio.org/

Fixes Bugzilla #2163.
(with several more commits following to improve this code.)
2017-06-08 13:27:58 -04:00
Olli Kallioinen 11289b766f Android cmake build fixed to work with the official android gradle plugin 2017-06-04 21:25:57 +03:00
Ryan C. Gordon dc8a22cd9c cmake: don't use /NODEFAULTLIB if we are using the C runtime (thanks, Rob!).
Fixes Bugzilla #3640.
2017-06-06 13:39:29 -04:00
Ryan C. Gordon a7fc2822d4 audio: rename bsd target to netbsd.
Apparently this is no longer a generic BSD audio target, and hasn't been for
years, so rename it for NetBSD.
2017-05-24 19:56:59 -04:00
Ryan C. Gordon 0e7530b057 cmake: add WASAPI audio target to the build (thanks, Martin!).
Fixes Bugzilla #3588.
2017-02-23 22:38:04 -05:00
Ryan C. Gordon 5ea0c893cd CMake: fixed logic error in setting -mfpmath=387.
Fixes Bugzilla #3565.
2017-01-24 12:20:41 -05:00
Ryan C. Gordon 3594bf8eeb audio: Wired up new SSE code to build system. 2017-01-23 01:05:44 -05:00
Sam Lantinga df25258a1e Added configure and cmake support for libsamplerate 2017-01-06 20:43:53 -08:00
Ryan C. Gordon 35430a73f2 cpuinfo: first attempt at SDL_HasNEON() implementation. 2016-11-17 01:15:16 -05:00
Sam Lantinga f3502c3c53 Fixed building with cmake when fcitx isn't installed 2016-10-14 01:04:21 -07:00
Sam Lantinga 34eebfba9b Fixed setting the version info in the shared library when using CMake
Ray Molenkamp

When building sdl as shared lib, the version info is lacking in the final binary.

CMake gathers the right resource files into ${VERSION_SOURCES} but then doesn't do anything with them.
2016-10-03 03:42:10 -07:00
Sam Lantinga c9be93c65b Fixed bug 3078 - cmake: fix sdl2.m4 install location on cross hosts
Timo Gurr

On cross hosts running autotools for SDL2_gfx-1.0.1 fails to find sdl2.m4:

eautoreconf: running in /var/tmp/paludis/build/media-libs-SDL2_gfx-1.0.1/work/SDL2_gfx-1.0.1 ...
aclocal
aclocal-1.13: warning: autoconf input should be named 'configure.ac', not 'configure.in'
configure.in:128: warning: macro 'AM_PATH_SDL2' not found in library
libtoolize --copy --force --automake
aclocal
aclocal-1.13: warning: autoconf input should be named 'configure.ac', not 'configure.in'
configure.in:128: warning: macro 'AM_PATH_SDL2' not found in library
autoconf
configure.in:128: error: possibly undefined macro: AM_PATH_SDL2
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
 * Failed Running autoconf !

SDL2 installs it to /usr/x86_64-pc-linux-gnu/share/aclocal on cross hosts, attached patch makes use of CMAKE_INSTALL_FULL_DATAROOTDIR to support correctly installing to the arch independent location /usr/share/aclocal.
2016-10-01 15:11:18 -07:00
Alex Szpakowski 571f4ce8a6 Fix CMake setting an incorrect video backend on iOS 2016-10-01 17:05:29 -03:00
Sam Lantinga 671f2a4914 Fixed bug 3268 - CMAKE: ios fixes
Martin Gerhardy

ios is not properly handled in the cmake file.

this patch is a start to do so - it properly builds for me with it.
2016-10-01 12:54:48 -07:00
Sam Lantinga bb24662c79 Fixed bug 3301 - IBus support on Linux with CMake
joe.gsoc16

I recently looked into Unicode support in SDL2 and realized that
SDL_TEXTEDITING doesn't get triggered at all (Japanese IME).
According to others on IRC it works fine on Windows/Mac but not
for me on (arch)Linux.
When compiling SDL with autotools, IBus support is enabled by
default but not so with CMake.
I never used CMake before but got it working and also included
that pkg-config determines flags for dbus (FIXME in CMakeLists).
2016-10-01 12:48:08 -07:00
Sam Lantinga e45698d218 Updated version to 2.0.5 in preparation for release 2016-09-28 22:24:01 -07:00
Sam Lantinga e5070d20ee Fixed set of libraries needed to build on Mac OS X 2016-09-15 08:57:56 -07:00
Sam Lantinga 93d42e2d3e Hopefully fixed the cmake build on Mac OS X 2016-09-15 08:46:14 -07:00
Jukka Jyl?nki 264e996e0f Fix CMake CMAKE_REQUIRED_FLAGS handling to preserve existing CMake flags required by Emscripten toolchain. 2016-09-13 00:03:50 -07:00
Charlie Birks 42feccea37 Include timers when using cmake (#29) 2016-09-13 00:03:40 -07:00
Ryan C. Gordon 6188c33420 mac: Patched to compile with CMake project. 2016-09-04 01:42:46 -04:00
Alex Szpakowski 2c3bf6658a Windows CMake: don't try to link dxguid, it's unavailable when using Visual Studio's XP-compatible toolset. 2016-03-18 22:15:53 -03:00
Sam Lantinga e5d575b933 Expose the EGL display and window for Vivante SDL windows 2016-01-16 21:58:49 -08:00
Ryan C. Gordon 1615b2e29d CMake: only set "-O3 -g" defaults if CMAKE_BUILD_TYPE wasn't set at all. 2016-01-08 07:32:51 -05:00
Sam Lantinga 757e994eaa Fixed --enable-new-dtags check with cmake 2016-01-07 17:21:50 -08:00
Sam Lantinga dc5f05bb99 Use --enable-new-dtags to set RUNPATH rather than RPATH so that LD_LIBRARY_PATH is not overridden by the application. 2016-01-07 16:42:30 -08:00
Ryan C. Gordon bb1e2bd0b5 CMake: Turned off Mac OS X rpath warning kludge.
Apparently CMake errors out if it doesn't know this policy, and we don't
otherwise require CMake 3.0 yet. Sigh.
2016-01-05 05:44:32 -05:00
Ryan C. Gordon e6e62bee71 CMake: Let static libraries optionally be built with Position Independent Code. 2016-01-05 01:26:32 -05:00
Ryan C. Gordon 008a6abd04 CMake: use the old MACOSX_RPATH behavior (for now), silence the warning. 2016-01-05 01:25:54 -05:00
Ryan C. Gordon 1373e8909a Try to build with GCC's -Wdeclaration-after-statement.
This will help catch things that'll cause issues on C89 compilers before we
send them on to fail on Buildbot.
2016-01-04 22:58:38 -05:00
Ryan C. Gordon 1240f8e0a6 CMake: Don't make a libSDL2.so symlink on Mac OS X (do .dylib instead). 2016-01-03 20:52:44 -05:00
Alex Szpakowski b0d8dfcd8a CMake: Fixed building for Windows with VS2015 (bug #3080).
- Don't try to link with the Visual C runtime.

- Avoid code generation that would use functions from the VC runtime.
2015-12-31 15:26:40 -04:00
Ryan C. Gordon 61518bce6b CMake: Changes to get CMake project to work with Android (thanks, Martin!).
Fixes Bugzilla #3194.

(but note that Bugzilla #3200 still needs to be resolved to get this really
going on Android, at a minimum.)
2015-12-29 00:57:24 -05:00
Ryan C. Gordon 7e679ed2c1 CMake: fixed a failure to reset CMAKE_REQUIRED_FLAGS (thanks, Martin!).
This would break Emscripten builds with the CMake project files (etc).

Fixes Bugzilla #3197.
2015-12-29 00:36:03 -05:00
Ryan C. Gordon c9927bbb17 CMake: don't try to use the Linux joystick code on Android (thanks, Martin!).
Fixes Bugzilla #3201.
2015-12-29 00:24:37 -05:00
Ryan C. Gordon 7ca3b27064 CMake: Fixed to work on Windows 8 SDK (thanks, Martin!).
Fixes Bugzilla #3207.
2015-12-29 00:02:43 -05:00
Alex Szpakowski 42f282cc1b Fix bug 3081: CMake configuration auto-disables OpenGL ES support on Windows.
Thanks to EntranceJew for the patch.
2015-08-28 19:10:46 -03:00
Alex Szpakowski d154e6c6e3 Fixed bug 3098: CMake project never enables xinput support on Windows.
Thanks to EntranceJew for debugging the issue.
2015-08-28 19:05:24 -03:00
Philipp Wiesemann 0e45984fa0 Fixed crash if initialization of EGL failed but was tried again later.
The internal function SDL_EGL_LoadLibrary() did not delete and remove a mostly
uninitialized data structure if loading the library first failed. A later try to
use EGL then skipped initialization and assumed it was previously successful
because the data structure now already existed. This led to at least one crash
in the internal function SDL_EGL_ChooseConfig() because a NULL pointer was
dereferenced to make a call to eglBindAPI().
2015-06-21 17:33:46 +02:00