Mesa (master): swrast: Fix signed/unsigned problems with negative strides.

Mathias Fröhlich frohlich at kemper.freedesktop.org
Thu Dec 1 20:46:45 UTC 2011


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

Author: Mathias Fröhlich <Mathias.Froehlich at web.de>
Date:   Thu Dec  1 20:48:10 2011 +0100

swrast: Fix signed/unsigned problems with negative strides.

In swrast_map_renderbuffer negative strides lead to
render buffer map pointers that are off by 2^32.
Make sure that intermediate negative values are not
converted to an unsigned.

Signed-off-by: Mathias Froehlich <Mathias.Froehlich at web.de>
Reviewed-by: Brian Paul <brianp at vmware.com>

---

 src/mesa/drivers/dri/swrast/swrast.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/swrast/swrast.c b/src/mesa/drivers/dri/swrast/swrast.c
index bc115e8..6297604 100644
--- a/src/mesa/drivers/dri/swrast/swrast.c
+++ b/src/mesa/drivers/dri/swrast/swrast.c
@@ -419,8 +419,8 @@ swrast_map_renderbuffer(struct gl_context *ctx,
       stride = -stride;
    }
 
-   map += y * stride;
-   map += x * cpp;
+   map += (GLsizei)y * stride;
+   map += (GLsizei)x * cpp;
 
    *out_map = map;
    *out_stride = stride;




More information about the mesa-commit mailing list