[Bf-blender-cvs] [5804bf25bdf] blender-v2.92-release: Fix uninitialized stack memory use accessing the snap normal

Campbell Barton noreply at git.blender.org
Thu Jan 14 00:57:11 CET 2021


Commit: 5804bf25bdfe2a29f8c763ab1015e89752baa195
Author: Campbell Barton
Date:   Thu Jan 14 10:30:28 2021 +1100
Branches: blender-v2.92-release
https://developer.blender.org/rB5804bf25bdfe2a29f8c763ab1015e89752baa195

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.

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

M	source/blender/editors/transform/transform_snap_object.c

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

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;



More information about the Bf-blender-cvs mailing list