svga: Disable bogus assertions concerning min_index/max_index.
authorJosé Fonseca <jfonseca@vmware.com>
Fri, 2 Mar 2012 12:44:00 +0000 (12:44 +0000)
committerJosé Fonseca <jfonseca@vmware.com>
Fri, 9 Mar 2012 18:57:17 +0000 (18:57 +0000)
min_index/max_index are merely conservative guesses, so we can't
make buffer overflow detection based on their values.

Tested-by: Jakob Bornecrantz <jakob@vmware.com>
src/gallium/drivers/svga/svga_draw.c

index c43d1a3443f37f9d2f07d94ba7245f01eda2d30b..41e0e1adc2f040230e5cb62476bc136105e5a3d0 100644 (file)
@@ -310,12 +310,6 @@ enum pipe_error svga_hwtnl_prim( struct svga_hwtnl *hwtnl,
          assert(size);
          assert(offset < size);
          assert(min_index <= max_index);
-         if (index_bias >= 0) {
-            assert(offset + index_bias*stride < size);
-         }
-         if (min_index != ~0 && index_bias >= 0) {
-            assert(offset + (index_bias + min_index) * stride < size);
-         }
 
          switch (hwtnl->cmd.vdecl[i].identity.type) {
          case SVGA3D_DECLTYPE_FLOAT1:
@@ -375,9 +369,14 @@ enum pipe_error svga_hwtnl_prim( struct svga_hwtnl *hwtnl,
             break;
          }
 
-         if (max_index != ~0) {
-            assert(offset + (index_bias + max_index) * stride + width <= size);
+         if (index_bias >= 0) {
+            assert(offset + index_bias*stride + width <= size);
          }
+
+         /*
+          * min_index/max_index are merely conservative guesses, so we can't
+          * make buffer overflow detection based on their values.
+          */
       }
 
       assert(range->indexWidth == range->indexArray.stride);