diff options
author | SeleckyErik <35656626+SeleckyErik@users.noreply.github.com> | 2021-10-31 18:48:51 +0100 |
---|---|---|
committer | SeleckyErik <35656626+SeleckyErik@users.noreply.github.com> | 2021-10-31 18:48:51 +0100 |
commit | 6b04f08b28fb1761f7a27d4ce876c52b1b210d5c (patch) | |
tree | c4e9a2e0a9b0d8a05bf420a1bbd2b0d2c676eb84 | |
parent | d6f972fad45d28222b1437a047241dd74f0d5b90 (diff) |
Fix multimesh buffer overflow in RendererStorageRD
-rw-r--r-- | servers/rendering/renderer_rd/renderer_storage_rd.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/servers/rendering/renderer_rd/renderer_storage_rd.cpp b/servers/rendering/renderer_rd/renderer_storage_rd.cpp index 99d1b88947..5c7fee7ec9 100644 --- a/servers/rendering/renderer_rd/renderer_storage_rd.cpp +++ b/servers/rendering/renderer_rd/renderer_storage_rd.cpp @@ -4419,7 +4419,8 @@ void RendererStorageRD::_update_dirty_multimeshes() { if (multimesh->data_cache_dirty_regions[i]) { uint32_t offset = i * region_size; uint32_t size = multimesh->stride_cache * (uint32_t)multimesh->instances * (uint32_t)sizeof(float); - RD::get_singleton()->buffer_update(multimesh->buffer, offset, MIN(region_size, size - offset), &data[i * region_size]); + uint32_t region_start_index = multimesh->stride_cache * MULTIMESH_DIRTY_REGION_SIZE * i; + RD::get_singleton()->buffer_update(multimesh->buffer, offset, MIN(region_size, size - offset), &data[region_start_index]); } } } |