From 13276e1f1eb32303b28105d7fb2cf6d17e736a89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Thu, 4 Jul 2024 11:04:00 +0200 Subject: [PATCH] Sculpting: initialise uninitialised variable Initialise `sum = 0.0f` before adding to it. Otherwise it'll get not just a compiler warning, but also undefined behaviour. --- source/blender/editors/sculpt_paint/brushes/draw_face_sets.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/editors/sculpt_paint/brushes/draw_face_sets.cc b/source/blender/editors/sculpt_paint/brushes/draw_face_sets.cc index 478656dadad..02998fde449 100644 --- a/source/blender/editors/sculpt_paint/brushes/draw_face_sets.cc +++ b/source/blender/editors/sculpt_paint/brushes/draw_face_sets.cc @@ -329,7 +329,7 @@ BLI_NOINLINE static void fill_factor_from_hide_and_mask(const BMesh &bm, const BMLoop *l_iter = f->l_first = BM_FACE_FIRST_LOOP(f); int total_verts = 0; - float sum; + float sum = 0.0f; do { BMVert *vert = l_iter->v; sum += BM_ELEM_CD_GET_FLOAT(vert, mask_offset);