From 12574f2ab448622648071cbac57f8dcc6a497563 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Thu, 1 Aug 2002 05:16:38 +0000 Subject: [PATCH] Make sure width and height passed to SDL_GetVideoMode() are sane. --- src/video/SDL_video.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index 61e300308..be1f4b2af 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -411,6 +411,11 @@ static int SDL_GetVideoMode (int *w, int *h, int *BitsPerPixel, Uint32 flags) 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 ) {