mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-06 04:30:10 +01:00
softpipe: Sanity check that the SSBO view offset is within the BO.
If we're going to check that the size matches, we should consider the buffer offset too. I haven't tracked down any testcases doing this, but it seems obviously correct. Reviewed-by: Dave Airlie <airlied@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8276>
This commit is contained in:
parent
851e3af07c
commit
ff2601ffec
1 changed files with 4 additions and 1 deletions
|
|
@ -40,8 +40,11 @@ sp_tgsi_ssbo_lookup(const struct tgsi_buffer *buffer,
|
|||
|
||||
struct pipe_shader_buffer *bview = &sp_buf->sp_bview[unit];
|
||||
/* Sanity check the view size is within our buffer. */
|
||||
if (!bview->buffer || bview->buffer_size > bview->buffer->width0)
|
||||
if (!bview->buffer ||
|
||||
bview->buffer_offset > bview->buffer->width0 ||
|
||||
bview->buffer_size > bview->buffer->width0 - bview->buffer_offset) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct softpipe_resource *spr = softpipe_resource(bview->buffer);
|
||||
*size = bview->buffer_size;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue