# HG changeset patch # User Ryan C. Gordon # Date 1028178998 0 # Node ID 60effdbf14eeec0ef26ddd3ee9c3ec59072f3f9d # Parent c1666427297c3b1209e8fd1a8beff47b760059d5 Make sure width and height passed to SDL_GetVideoMode() are sane. diff -r c1666427297c -r 60effdbf14ee src/video/SDL_video.c --- a/src/video/SDL_video.c Tue Jul 30 07:25:43 2002 +0000 +++ b/src/video/SDL_video.c Thu Aug 01 05:16:38 2002 +0000 @@ -411,6 +411,11 @@ SDL_PixelFormat format; SDL_Rect **sizes; + if ((*w <= 0) || (*h <= 0)) { + SDL_SetError("Invalid parameter"); + return(0); + } + /* Try the original video mode, get the closest depth */ native_bpp = SDL_VideoModeOK(*w, *h, *BitsPerPixel, flags); if ( native_bpp == *BitsPerPixel ) {