r300g: Check for bogus texture targets.
authorCorbin Simpson <MostAwesomeDude@gmail.com>
Sun, 17 Jan 2010 09:13:45 +0000 (01:13 -0800)
committerCorbin Simpson <MostAwesomeDude@gmail.com>
Sun, 17 Jan 2010 09:13:45 +0000 (01:13 -0800)
src/gallium/drivers/r300/r300_screen.c

index e9727e9..67325c6 100644 (file)
@@ -192,6 +192,12 @@ static boolean r300_is_format_supported(struct pipe_screen* screen,
     uint32_t retval = 0;
     boolean is_r500 = r300_screen(screen)->caps->is_r500;
 
+    if (target >= PIPE_MAX_TEXTURE_TYPES) {
+        debug_printf("r300: Implementation error: Received bogus texture "
+            "target %d in %s\n", target, __FUNCTION__);
+        return FALSE;
+    }
+
     switch (format) {
         /* Supported formats. */
         /* Colorbuffer */