We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 1530

Summary: X11 touch initialisation does not check its file handles
Product: SDL Reporter: Marcus von Appen <mva>
Component: videoAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: critical    
Priority: P2    
Version: HG 2.0   
Hardware: All   
OS: FreeBSD   
Attachments: NULL pointer fix for X11_InitTouch()

Description Marcus von Appen 2012-06-27 23:58:11 UTC
Created attachment 891 [details]
NULL pointer fix for X11_InitTouch()

On X11 a NULL pointer SIGSEGV might occur on call X11_InitTouch, if the user
has only limited access to /proc or if /proc is not mounted for whatever reason:

#0  0x000000080107d88b in flockfile () from /lib/libc.so.7
#1  0x0000000800fee6e3 in feof () from /lib/libc.so.7
#2  0x0000000804310a58 in X11_InitTouch (_this=0x8016d7800)
    at ../src/video/x11/SDL_x11touch.c:55
#3  0x00000008043114ad in X11_VideoInit (_this=0x8016d7800)
    at ../src/video/x11/SDL_x11video.c:371
#4  0x00000008042f9b9a in SDL_VideoInit (driver_name=0x0)

It must be ensured that the return value of fopen("/proc/....") is not NULL.
Comment 1 Sam Lantinga 2012-07-02 05:33:47 UTC
Fixed, thanks!
http://hg.libsdl.org/SDL/rev/049721824c2e