st/readpixels: fix accel path for skipimages.
authorDave Airlie <airlied@redhat.com>
Tue, 1 Sep 2015 05:13:45 +0000 (15:13 +1000)
committerDave Airlie <airlied@redhat.com>
Tue, 1 Sep 2015 23:30:48 +0000 (09:30 +1000)
We don't need to use the 3d image address here as that will
include SKIP_IMAGES, and we are only blitting a single
2D anyways, so just use the 2D path.

This fixes some memory overruns under CTS
 packed_pixels.packed_pixels_pixelstore when PACK_SKIP_IMAGES
is used.

Cc: "11.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
src/mesa/state_tracker/st_cb_readpixels.c

index 6ff6cf6f6d6bfe0eaf0c014dbfef78d669e44173..bb36e6969d6c88260c08637791878d73772c689e 100644 (file)
@@ -238,9 +238,9 @@ st_readpixels(struct gl_context *ctx, GLint x, GLint y,
       GLuint row;
 
       for (row = 0; row < (unsigned) height; row++) {
-         GLvoid *dest = _mesa_image_address3d(pack, pixels,
+         GLvoid *dest = _mesa_image_address2d(pack, pixels,
                                               width, height, format,
-                                              type, 0, row, 0);
+                                              type, row, 0);
          memcpy(dest, map, bytesPerRow);
          map += tex_xfer->stride;
       }