From ca938e5a74c057e656da9ac0254313429410d2fe Mon Sep 17 00:00:00 2001 From: Patrice Mandin Date: Tue, 2 Sep 2003 19:49:50 +0000 Subject: [PATCH] Severe bugfix: format->BitsPerPixel not checked in ListModes function --- src/video/xbios/SDL_xbios.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/video/xbios/SDL_xbios.c b/src/video/xbios/SDL_xbios.c index b2639d8ae..8ed095ec8 100644 --- a/src/video/xbios/SDL_xbios.c +++ b/src/video/xbios/SDL_xbios.c @@ -400,9 +400,19 @@ static int XBIOS_VideoInit(_THIS, SDL_PixelFormat *vformat) static SDL_Rect **XBIOS_ListModes(_THIS, SDL_PixelFormat *format, Uint32 flags) { + unsigned int numlist; + /* 8 bits -> list 0 */ /* 16 bits -> list 1 */ - return(SDL_modelist[(format->BitsPerPixel)>>4]); + if (format->BitsPerPixel == 15) { + return NULL; + } + + numlist = (format->BitsPerPixel)>>4; + if (numlist>1) + return NULL; + + return(SDL_modelist[numlist]); } static void XBIOS_FreeBuffers(_THIS)