Make sure width and height passed to SDL_GetVideoMode() are sane.
authorRyan C. Gordon <icculus@icculus.org>
Thu, 01 Aug 2002 05:16:38 +0000
changeset 43060effdbf14ee
parent 429 c1666427297c
child 431 41cadcba32e8
Make sure width and height passed to SDL_GetVideoMode() are sane.
src/video/SDL_video.c
     1.1 --- a/src/video/SDL_video.c	Tue Jul 30 07:25:43 2002 +0000
     1.2 +++ b/src/video/SDL_video.c	Thu Aug 01 05:16:38 2002 +0000
     1.3 @@ -411,6 +411,11 @@
     1.4  	SDL_PixelFormat format;
     1.5  	SDL_Rect **sizes;
     1.6  
     1.7 +	if ((*w <= 0) || (*h <= 0)) {
     1.8 +		SDL_SetError("Invalid parameter");
     1.9 +		return(0);
    1.10 +	}
    1.11 +
    1.12  	/* Try the original video mode, get the closest depth */
    1.13  	native_bpp = SDL_VideoModeOK(*w, *h, *BitsPerPixel, flags);
    1.14  	if ( native_bpp == *BitsPerPixel ) {