From 7d384b4a018f5c8a9807fdf13b3ed7b76501aba6 Mon Sep 17 00:00:00 2001 From: Jeroen Bakker Date: Thu, 14 Aug 2025 10:55:26 +0200 Subject: [PATCH] Fix #143691: Out of bounds 2d painting When doing 2D image painting the region on the GPU that is updated could be out of bounds of the texture, resulting in a crash. This PR fixes this by clamping the gpu region to update to the actual image size. Pull Request: https://projects.blender.org/blender/blender/pulls/144545 --- source/blender/draw/engines/image/image_drawing_mode.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/blender/draw/engines/image/image_drawing_mode.cc b/source/blender/draw/engines/image/image_drawing_mode.cc index 2ae371de2f2..1ac24e62f6f 100644 --- a/source/blender/draw/engines/image/image_drawing_mode.cc +++ b/source/blender/draw/engines/image/image_drawing_mode.cc @@ -188,6 +188,10 @@ void ScreenSpaceDrawingMode::do_partial_update( texture_height / BLI_rctf_size_y(&info.clipping_uv_bounds)), ceil((changed_overlapping_region_in_uv_space.ymax - info.clipping_uv_bounds.ymin) * texture_height / BLI_rctf_size_y(&info.clipping_uv_bounds))); + gpu_texture_region_to_update.xmax = min_ii(gpu_texture_region_to_update.xmax, + info.clipping_bounds.xmax); + gpu_texture_region_to_update.ymax = min_ii(gpu_texture_region_to_update.ymax, + info.clipping_bounds.ymax); rcti tile_region_to_extract; BLI_rcti_init(