[Bf-blender-cvs] [1cf8a4e5ea5] master: Fix Asan warning in property editor texture tab
Hans Goudey
noreply at git.blender.org
Wed Oct 14 17:00:32 CEST 2020
Commit: 1cf8a4e5ea5dc1e791c1b242d7d2d032dd194c78
Author: Hans Goudey
Date: Wed Oct 14 10:00:24 2020 -0500
Branches: master
https://developer.blender.org/rB1cf8a4e5ea5dc1e791c1b242d7d2d032dd194c78
Fix Asan warning in property editor texture tab
When there is no active texture, a NULL pointer was dereferenced.
It didn't crash because the dereference was for the first item at the
pointer, the ID. To fix this, return with no data when `texture is NULL.
===================================================================
M source/blender/editors/space_buttons/buttons_context.c
===================================================================
diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c
index 0b018d05058..dcf2e6e74fa 100644
--- a/source/blender/editors/space_buttons/buttons_context.c
+++ b/source/blender/editors/space_buttons/buttons_context.c
@@ -880,6 +880,10 @@ int /*eContextResult*/ buttons_context(const bContext *C,
ButsContextTexture *ct = sbuts->texuser;
if (ct) {
+ if (ct->texture == NULL) {
+ return CTX_RESULT_NO_DATA;
+ }
+
CTX_data_pointer_set(result, &ct->texture->id, &RNA_Texture, ct->texture);
}
More information about the Bf-blender-cvs
mailing list