changeset 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 c1666427297c
children 41cadcba32e8
files src/video/SDL_video.c
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
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 ) {