author Sam Lantinga <>
Wed, 10 Jul 2013 21:57:31 -0700
changeset 7396 a36ab6149a10
parent 7241 28602f5ca96d
permissions -rw-r--r--
Fixed bug 1953 - Crash at memcpy X11_DispatchEvent(_THIS) Function Nitz In Function X11_DispatchEvent(_THIS), case SelectionNotify : static void X11_DispatchEvent(_THIS) { // Some Code case SelectionNotify: { //Some Code SDL_bool expect_lf = SDL_FALSE; char *start = NULL; // Initialised with NULL char *scan = (char*); char *fn; char *uri; int length = 0; while (p.count--) { if (!expect_lf) { if (*scan==0x0D) { expect_lf = SDL_TRUE; } else if(start == NULL) { start = scan; length = 0; } length++; } else { if (*scan==0x0A && length>0) { uri = malloc(length--); memcpy(uri, start, length); // Problem is Here, start is still NULL if control comes to else statement without initialising the start pointer, which is wrong uri[length] = 0; fn = X11_URIToLocal(uri); if (fn) SDL_SendDropFile(fn); free(uri); } expect_lf = SDL_FALSE; start = NULL; } scan++; } } As shown above how start pointer remains NULL, Patch for this issue would be: if (*scan==0x0D) { expect_lf = SDL_TRUE; } if(start == NULL) { start = scan; length = 0; } Just replace else if statement with if.

The latest development version of SDL is available via Mercurial.
Mercurial allows you to get up-to-the-minute fixes and enhancements;
as a developer works on a source tree, you can use "hg" to mirror that
source tree instead of waiting for an official release. Please look
at the Mercurial website ( ) for more
information on using hg, where you can also download software for
Mac OS X, Windows, and Unix systems.

  hg clone

If you are building SDL with an IDE, you will need to copy the file
include/SDL_config.h.default to include/SDL_config.h before building.

If you are building SDL via configure, you will need to run
before running configure.

There is a web interface to the subversion repository at:

There is an RSS feed available at that URL, for those that want to
track commits in real time.