summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEduardo Lima Mitev <[email protected]>2016-11-22 12:12:48 +0100
committerEduardo Lima Mitev <[email protected]>2016-11-23 09:22:32 +0100
commit6e8f12619f921673b48f18f9856d9e919869e1ed (patch)
tree3819f26bd3076a12810db722fb9176b70df09e9e
parente062eb6415de3aa51b43f30d638ce8215efc0511 (diff)
main/getteximage: Use the height argument to calculate memcpy copy size
In get_tex_memcpy, when copying texture data directly from source to destination (when row strides match for both src and dst), the copy size is currently calculated using the full texture height instead of the sub-region height parameter that was passed. This can cause a read past the end of the mapped buffer when y-offset is greater than zero, leading to a segfault. Fixes CTS test (from crash to pass): * GL45-CTS/get_texture_sub_image/functional_test v2: (Jason) Use the passed 'height' instead of copying til the end of the buffer (tex-height - yoffset). Reviewed-by: Jason Ekstrand <[email protected]>
-rw-r--r--src/mesa/main/texgetimage.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c
index b9002787344..0186819994e 100644
--- a/src/mesa/main/texgetimage.c
+++ b/src/mesa/main/texgetimage.c
@@ -654,7 +654,7 @@ get_tex_memcpy(struct gl_context *ctx,
if (src) {
if (bytesPerRow == dstRowStride && bytesPerRow == srcRowStride) {
- memcpy(dst, src, bytesPerRow * texImage->Height);
+ memcpy(dst, src, bytesPerRow * height);
}
else {
GLuint row;