Mesa (mesa_7_7_branch): gallium/draw: fix overflowing element indices

Zack Rusin zack at kemper.freedesktop.org
Sat Feb 6 00:25:48 UTC 2010


Module: Mesa
Branch: mesa_7_7_branch
Commit: a6148b8eba35a0d4efec4dcca5e3ac6d86708a58
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a6148b8eba35a0d4efec4dcca5e3ac6d86708a58

Author: Zack Rusin <zackr at vmware.com>
Date:   Fri Feb  5 18:57:10 2010 -0500

gallium/draw: fix overflowing element indices

we piggy back flags in the top four bits of the element indices, so if
the maximum index stored in any of the elements is greater than
sizeof(ushort) - sizeof(flags we piggy back) then we overflow. fix it by
simply falling back to the slow path if we notice the overflow.

---

 src/gallium/auxiliary/draw/draw_pt_vcache.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_pt_vcache.c b/src/gallium/auxiliary/draw/draw_pt_vcache.c
index d3f179c..a87ec30 100644
--- a/src/gallium/auxiliary/draw/draw_pt_vcache.c
+++ b/src/gallium/auxiliary/draw/draw_pt_vcache.c
@@ -347,7 +347,8 @@ vcache_check_run( struct draw_pt_front_end *frontend,
                        draw_count);
       
    if (max_index == 0xffffffff ||
-       fetch_count > draw_count) {
+       fetch_count > draw_count ||
+       max_index != (max_index & ~DRAW_PIPE_FLAG_MASK)) {
       if (0) debug_printf("fail\n");
       goto fail;
    }




More information about the mesa-commit mailing list