Mesa (llvmpipe-rast-64): We missed a few variable which need to be promoted to 64 bits.

Zack Rusin zack at kemper.freedesktop.org
Thu Nov 7 20:40:58 UTC 2013


Module: Mesa
Branch: llvmpipe-rast-64
Commit: 13b37abd2f5c6a6fb0d9da6386622bd7cbd2caff
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=13b37abd2f5c6a6fb0d9da6386622bd7cbd2caff

Author: Zack Rusin <zackr at vmware.com>
Date:   Thu Nov  7 15:38:59 2013 -0500

We missed a few variable which need to be promoted to 64 bits.

xstep/ystep are created by shifting dcdx/dcdy which can overflow
32 bits. same happens for eo and ei - the tile shift can overflow
the variables with fixed order greater than 4.

---

 src/gallium/drivers/llvmpipe/lp_setup_tri.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_setup_tri.c b/src/gallium/drivers/llvmpipe/lp_setup_tri.c
index c6add87..e31f859 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup_tri.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup_tri.c
@@ -678,11 +678,11 @@ lp_setup_bin_triangle( struct lp_setup_context *setup,
    {
       struct lp_rast_plane *plane = GET_PLANES(tri);
       int64_t c[MAX_PLANES];
-      int ei[MAX_PLANES];
+      int64_t ei[MAX_PLANES];
 
-      int eo[MAX_PLANES];
-      int xstep[MAX_PLANES];
-      int ystep[MAX_PLANES];
+      int64_t eo[MAX_PLANES];
+      int64_t xstep[MAX_PLANES];
+      int64_t ystep[MAX_PLANES];
       int x, y;
 
       int ix0 = trimmed_box.x0 / TILE_SIZE;
@@ -700,8 +700,8 @@ lp_setup_bin_triangle( struct lp_setup_context *setup,
                   plane[i].eo) << TILE_ORDER;
 
          eo[i] = plane[i].eo << TILE_ORDER;
-         xstep[i] = -(plane[i].dcdx << TILE_ORDER);
-         ystep[i] = plane[i].dcdy << TILE_ORDER;
+         xstep[i] = -(((int64_t)plane[i].dcdx) << TILE_ORDER);
+         ystep[i] = ((int64_t)plane[i].dcdy) << TILE_ORDER;
       }
 
 




More information about the mesa-commit mailing list