Mesa (master): r300g: Check for bogus texture targets.

Corbin Simpson csimpson at kemper.freedesktop.org
Sun Jan 17 09:14:58 UTC 2010


Module: Mesa
Branch: master
Commit: 945cea01d9620ddd6a459e30517080e2bceb6bc5
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=945cea01d9620ddd6a459e30517080e2bceb6bc5

Author: Corbin Simpson <MostAwesomeDude at gmail.com>
Date:   Sun Jan 17 01:13:45 2010 -0800

r300g: Check for bogus texture targets.

---

 src/gallium/drivers/r300/r300_screen.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c
index e9727e9..67325c6 100644
--- a/src/gallium/drivers/r300/r300_screen.c
+++ b/src/gallium/drivers/r300/r300_screen.c
@@ -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 */




More information about the mesa-commit mailing list