diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-09-15 06:16:31 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-09-15 06:33:34 +0300 |
commit | e51ff299191715ec12ffff34748e6bfc998e1a12 (patch) | |
tree | 431990b3601def24418bbad6bbd3be4502bbb24a /source/blender/bmesh/intern | |
parent | 0b6d7bab5a148b316a9067e30cda9155af331777 (diff) |
BMesh: avoid negative array access in shape-key conversion
Diffstat (limited to 'source/blender/bmesh/intern')
-rw-r--r-- | source/blender/bmesh/intern/bmesh_mesh_convert.c | 5 |
1 files changed, 4 insertions, 1 deletions
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); |