summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathias Fröhlich <Mathias.Froehlich@web.de>2011-12-01 20:48:10 +0100
committerMathias Fröhlich <Mathias.Froehlich@web.de>2011-12-01 21:44:57 +0100
commita4c952f36f0c6b55f1410bc678b21f75de253a74 (patch)
tree7b0b1764f47bda77c821b0cffce8ccb981036a8f
parentde93347d482a96f88c898622c9620f03e677e386 (diff)
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@web.de> Reviewed-by: Brian Paul <brianp@vmware.com>
-rw-r--r--src/mesa/drivers/dri/swrast/swrast.c4
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 bc115e8cf1a..629760441ad 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;