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 e9727e99df461bbe251007807f5d13860fa1adef..67325c6b80a0b66c37a46c97e390f1cf46d8f10f 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 */