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 430 60effdbf14ee
parent 429 c1666427297c
child 431 41cadcba32e8
Make sure width and height passed to SDL_GetVideoMode() are sane.
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 ) {