diff src/video/SDL_video.c @ 430:60effdbf14ee

Make sure width and height passed to SDL_GetVideoMode() are sane.
author Ryan C. Gordon <icculus@icculus.org>
date Thu, 01 Aug 2002 05:16:38 +0000
parents d1565c52ded5
children 706de3956894
line wrap: on
line diff
--- 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 ) {