# HG changeset patch # User Sam Lantinga # Date 1231818802 0 # Node ID 0e821769fc5146cb2e27ae0b2e149f913c0bb197 # Parent 4e4f47c5f9417dd99e5592f1661e60d99b31c522 Fixed NULL pointer dereference diff -r 4e4f47c5f941 -r 0e821769fc51 CREDITS --- a/CREDITS Mon Jan 12 22:36:12 2009 +0000 +++ b/CREDITS Tue Jan 13 03:53:22 2009 +0000 @@ -25,8 +25,9 @@ * Szymon "Wilku" Wilczek for adding support for multiple mice and tablets during the Google Summer of Code 2008 -* Marty Leisner, Andrew, Will, Edgar Simo, Donny Viszneki, and Couriersud - for helping find SDL 1.3 bugs in the great SDL Bug Hunt of January 2009! +* Marty Leisner, Andrew, Will, Edgar Simo, Donny Viszneki, Andrea Mazzoleni, + and Couriersud for helping find SDL 1.3 bugs in the great SDL Bug Hunt + of January 2009! * Donny Viszneki for helping fix SDL 1.3 bugs in the great SDL Bug Hunt of January 2009! diff -r 4e4f47c5f941 -r 0e821769fc51 include/SDL_compat.h --- a/include/SDL_compat.h Mon Jan 12 22:36:12 2009 +0000 +++ b/include/SDL_compat.h Tue Jan 13 03:53:22 2009 +0000 @@ -228,8 +228,7 @@ extern DECLSPEC int SDLCALL SDL_VideoModeOK(int width, int height, int bpp, Uint32 flags); -extern DECLSPEC SDL_Rect **SDLCALL SDL_ListModes(SDL_PixelFormat * format, - Uint32 flags); +extern DECLSPEC SDL_Rect **SDLCALL SDL_ListModes(const SDL_PixelFormat * format, Uint32 flags); extern DECLSPEC SDL_Surface *SDLCALL SDL_SetVideoMode(int width, int height, int bpp, Uint32 flags); diff -r 4e4f47c5f941 -r 0e821769fc51 src/SDL_compat.c --- a/src/SDL_compat.c Mon Jan 12 22:36:12 2009 +0000 +++ b/src/SDL_compat.c Tue Jan 13 03:53:22 2009 +0000 @@ -114,7 +114,7 @@ } SDL_Rect ** -SDL_ListModes(SDL_PixelFormat * format, Uint32 flags) +SDL_ListModes(const SDL_PixelFormat * format, Uint32 flags) { int i, nmodes; SDL_Rect **modes; @@ -127,6 +127,10 @@ return (SDL_Rect **) (-1); } + if (!format) { + format = SDL_GetVideoInfo()->vfmt; + } + /* Memory leak, but this is a compatibility function, who cares? */ nmodes = 0; modes = NULL;