changeset 711:8db4098e944b

Severe bugfix: format->BitsPerPixel not checked in ListModes function
author Patrice Mandin <patmandin@gmail.com>
date Tue, 02 Sep 2003 19:49:50 +0000
parents 86de11faf082
children 8be92df64b22
files src/video/xbios/SDL_xbios.c
diffstat 1 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/video/xbios/SDL_xbios.c	Sun Aug 31 02:58:29 2003 +0000
+++ b/src/video/xbios/SDL_xbios.c	Tue Sep 02 19:49:50 2003 +0000
@@ -400,9 +400,19 @@
 
 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)