From 8d11882d079e50b69a579361a3bb7ffa847d9265 Mon Sep 17 00:00:00 2001 From: notrudyyy <rudy.vempati@gmail.com> Date: Tue, 1 Oct 2024 00:04:53 +0200 Subject: [PATCH] Fix #128257: Crash when using Set Vertex Colors with no brush The issue is due to a null pointer dereference in the call to `IMB_colormanagement_srgb_to_scene_linear_v3` in `vpaint_get_current_col` in `paint_vertex.cc`. `BKE_paint_brush_for_read` returns a null pointer and as a result `brush_color` points to the zero page, thus causing a null pointer dereference and hence the access violation exception. Normally, users should not be able to have no brush selected inside vertex paint mode. Instead of adding null checks everywhere, this commit protects against this case by switching the poll method to check for a brush before allowing execution. Pull Request: https://projects.blender.org/blender/blender/pulls/128260 --- source/blender/editors/sculpt_paint/paint_vertex.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/editors/sculpt_paint/paint_vertex.cc b/source/blender/editors/sculpt_paint/paint_vertex.cc index 7ee16f2c029..395f8243898 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.cc +++ b/source/blender/editors/sculpt_paint/paint_vertex.cc @@ -2320,7 +2320,7 @@ void PAINT_OT_vertex_color_set(wmOperatorType *ot) ot->description = "Fill the active vertex color layer with the current paint color"; ot->exec = vertex_color_set_exec; - ot->poll = vertex_paint_mode_poll; + ot->poll = vertex_paint_poll; ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; -- GitLab