Skip to content

Commit

Permalink
Make sure width and height passed to SDL_GetVideoMode() are sane.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Aug 1, 2002
1 parent 4419162 commit 12574f2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/video/SDL_video.c
Expand Up @@ -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 ) {
Expand Down

0 comments on commit 12574f2

Please sign in to comment.