From: Mathias Fröhlich Date: Thu, 1 Dec 2011 19:48:10 +0000 (+0100) Subject: swrast: Fix signed/unsigned problems with negative strides. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a4c952f36f0c6b55f1410bc678b21f75de253a74;p=mesa.git 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 Reviewed-by: Brian Paul --- 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;