Mesa (main): lavapipe: Prevent mapping buffers beyond their size.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jun 28 10:44:29 UTC 2022


Module: Mesa
Branch: main
Commit: 382c6d395c94f64758e51b287e684fe24a1dfb0a
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=382c6d395c94f64758e51b287e684fe24a1dfb0a

Author: Jose Fonseca <jfonseca at vmware.com>
Date:   Thu Jun 16 09:28:34 2022 +0100

lavapipe: Prevent mapping buffers beyond their size.

This was breaking trace driver serialization, since it relies upon the
transfer box to know what to serialize.

Reviewed-by: Brian Paul <brianp at vmware.com>
Reviewed-by: Roland Scheidegger <sroland at vmware.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17107>

---

 src/gallium/frontends/lavapipe/lvp_execute.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/frontends/lavapipe/lvp_execute.c b/src/gallium/frontends/lavapipe/lvp_execute.c
index 3c2aadc2f2a..e62389114f2 100644
--- a/src/gallium/frontends/lavapipe/lvp_execute.c
+++ b/src/gallium/frontends/lavapipe/lvp_execute.c
@@ -2202,7 +2202,7 @@ static void handle_copy_image_to_buffer2(struct vk_cmd_queue_entry *cmd,
       dbox.x = copycmd->pRegions[i].bufferOffset;
       dbox.y = 0;
       dbox.z = 0;
-      dbox.width = lvp_buffer_from_handle(copycmd->dstBuffer)->bo->width0;
+      dbox.width = lvp_buffer_from_handle(copycmd->dstBuffer)->bo->width0 - copycmd->pRegions[i].bufferOffset;
       dbox.height = 1;
       dbox.depth = 1;
       dst_data = state->pctx->buffer_map(state->pctx,



More information about the mesa-commit mailing list