[Bf-blender-cvs] [e51ff299191] master: BMesh: avoid negative array access in shape-key conversion

Campbell Barton noreply at git.blender.org
Tue Sep 15 05:33:45 CEST 2020


Commit: e51ff299191715ec12ffff34748e6bfc998e1a12
Author: Campbell Barton
Date:   Tue Sep 15 13:16:31 2020 +1000
Branches: master
https://developer.blender.org/rBe51ff299191715ec12ffff34748e6bfc998e1a12

BMesh: avoid negative array access in shape-key conversion

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

M	source/blender/bmesh/intern/bmesh_mesh_convert.c

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

diff --git a/source/blender/bmesh/intern/bmesh_mesh_convert.c b/source/blender/bmesh/intern/bmesh_mesh_convert.c
index e30a0ca984a..90b0cca4b9c 100644
--- a/source/blender/bmesh/intern/bmesh_mesh_convert.c
+++ b/source/blender/bmesh/intern/bmesh_mesh_convert.c
@@ -895,7 +895,10 @@ void BM_mesh_bm_to_me(Main *bmain, BMesh *bm, Mesh *me, const struct BMeshToMesh
       float *newkey, (*oldkey)[3], *fp;
 
       const int currkey_uuid = bm_to_mesh_shape_layer_index_from_kb(bm, currkey);
-      const int cd_shape_offset = CustomData_get_n_offset(&bm->vdata, CD_SHAPEKEY, currkey_uuid);
+      const int cd_shape_offset = (currkey_uuid == -1) ? -1 :
+                                                         CustomData_get_n_offset(&bm->vdata,
+                                                                                 CD_SHAPEKEY,
+                                                                                 currkey_uuid);
       const bool apply_offset = (cd_shape_offset != -1) && (ofs != NULL) && (currkey != actkey) &&
                                 (bm->shapenr - 1 == currkey->relative);



More information about the Bf-blender-cvs mailing list