[Bf-blender-cvs] [97d50850619] greasepencil-object: GPencil: Check grid cell index range

Antonio Vazquez noreply at git.blender.org
Mon Nov 11 10:30:21 CET 2019


Commit: 97d50850619a30a9a2c5f141ca049d2a97a30e4d
Author: Antonio Vazquez
Date:   Mon Nov 11 10:30:12 2019 +0100
Branches: greasepencil-object
https://developer.blender.org/rB97d50850619a30a9a2c5f141ca049d2a97a30e4d

GPencil: Check grid cell index range

It could get wrong values in corner case situations.

===================================================================

M	source/blender/editors/gpencil/gpencil_vertex_paint.c

===================================================================

diff --git a/source/blender/editors/gpencil/gpencil_vertex_paint.c b/source/blender/editors/gpencil/gpencil_vertex_paint.c
index b5006b93401..130a9ca85b7 100644
--- a/source/blender/editors/gpencil/gpencil_vertex_paint.c
+++ b/source/blender/editors/gpencil/gpencil_vertex_paint.c
@@ -660,6 +660,7 @@ static bool brush_smear_apply(tGP_BrushVertexpaintData *gso,
     CLAMP(col, 0, gso->grid_size);
 
     int new_index = (row * gso->grid_size) + col;
+    CLAMP(new_index, 0, gso->grid_len - 1);
     grid = &gso->grid[new_index];
   }



More information about the Bf-blender-cvs mailing list