Commit 2abeb180 authored by Gert Wollny's avatar Gert Wollny
Browse files

vrend: check that the transfer iov holds enough data for the data upload

Closes #140

Signed-off-by: Gert Wollny's avatarGert Wollny <gert.wollny@collabora.com>
Reviewed-by: Emil Velikov's avatarEmil Velikov <emil.velikov@collabora.com>
parent 8c9cfb4e
Pipeline #69734 passed with stages
in 12 minutes and 45 seconds
......@@ -7005,15 +7005,22 @@ static int vrend_renderer_transfer_write_iov(struct vrend_context *ctx,
invert = true;
}
send_size = util_format_get_nblocks(res->base.format, info->box->width,
info->box->height) * elsize;
if (res->target == GL_TEXTURE_3D ||
res->target == GL_TEXTURE_2D_ARRAY ||
res->target == GL_TEXTURE_CUBE_MAP_ARRAY)
send_size *= info->box->depth;
if (need_temp) {
send_size = util_format_get_nblocks(res->base.format, info->box->width,
info->box->height) * elsize * info->box->depth;
data = malloc(send_size);
if (!data)
return ENOMEM;
read_transfer_data(iov, num_iovs, data, res->base.format, info->offset,
stride, layer_stride, info->box, invert);
} else {
if (send_size > iov[0].iov_len - info->offset)
return EINVAL;
data = (char*)iov[0].iov_base + info->offset;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment