diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-01-14 02:30:28 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-01-14 02:55:49 +0300 |
commit | 5804bf25bdfe2a29f8c763ab1015e89752baa195 (patch) | |
tree | 3f9cb82970082b929045d2c59e8839f2be6d4f43 | |
parent | 01b9dfeab49783f040145824eaf2029c494a4a8a (diff) |
Fix uninitialized stack memory use accessing the snap normal
Using the add-object tool, snapping to object types such as
curve, armature ... etc, copied uninitialized stack memory.
-rw-r--r-- | source/blender/editors/transform/transform_snap_object.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/source/blender/editors/transform/transform_snap_object.c b/source/blender/editors/transform/transform_snap_object.c index 50b7c6d147b..b610369f82d 100644 --- a/source/blender/editors/transform/transform_snap_object.c +++ b/source/blender/editors/transform/transform_snap_object.c @@ -3026,7 +3026,11 @@ static short transform_snap_context_project_view3d_mixed_impl( bool has_hit = false; Object *ob = NULL; - float loc[3], no[3], obmat[4][4]; + float loc[3]; + /* Not all snapping callbacks set the normal, + * initialize this since any hit copies both the `loc` and `no`. */ + float no[3] = {0.0f, 0.0f, 0.0f}; + float obmat[4][4]; int index = -1; const ARegion *region = sctx->v3d_data.region; |