Hi,

The attached patch fixes a core dump in glReadPixels with traditional swrast.
The problem looks pretty much the same like the one the VTK guy Kevin H. Hobbs 
reports. At least his backtrace is mostly the same.

Please review.

Thanks

Mathias
From 92eaecb0f471d6705121ca346b43e3709989847f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mathias=20Fr=C3=B6hlich?= <[email protected]>
Date: Thu, 1 Dec 2011 20:48:10 +0100
Subject: [PATCH] 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 <[email protected]>
---
 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;
-- 
1.7.4.4

_______________________________________________
mesa-dev mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to