[Bf-blender-cvs] [bd4ed5ca9ae] master: Fix "use after scope" reported by ASAN

Hans Goudey noreply at git.blender.org
Sun Jan 24 01:38:57 CET 2021


Commit: bd4ed5ca9ae2a7b0f6a00cc0c985404ab13cc5d6
Author: Hans Goudey
Date:   Sat Jan 23 18:38:51 2021 -0600
Branches: master
https://developer.blender.org/rBbd4ed5ca9ae2a7b0f6a00cc0c985404ab13cc5d6

Fix "use after scope" reported by ASAN

The float array is declared inside a smaller scope, pointed to, and then
used later. This simply moves the declaration outside of the if statement.
Also remove two redundant lines.

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

M	source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c

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

diff --git a/source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c b/source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c
index 4d0f0586696..59cafd9367f 100644
--- a/source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c
+++ b/source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c
@@ -226,17 +226,15 @@ static void gizmo_axis_draw(const bContext *C, wmGizmo *gz)
     if (!is_aligned_back) {
       float *inner_color = fading_color;
       float *outline_color = fading_color;
+      float negative_color[4];
       if (!is_pos) {
-        float negative_color[4];
         if (is_aligned_front) {
-          inner_color = fading_color;
           interp_v4_v4v4(
               negative_color, (float[4]){1.0f, 1.0f, 1.0f, 1.0f}, axis_color[axis], 0.5f);
           negative_color[3] = MIN2(depth + 1, 1.0f);
           outline_color = negative_color;
         }
         else {
-          outline_color = fading_color;
           interp_v4_v4v4(negative_color, view_color, axis_color[axis], 0.25f);
           negative_color[3] = MIN2(depth + 1, 1.0f);
           inner_color = negative_color;



More information about the Bf-blender-cvs mailing list