[Bf-blender-cvs] [0c0bc619181] master: Fix access to invalid data in Outliner tree building

Julian Eisel noreply at git.blender.org
Mon Dec 7 14:36:04 CET 2020


Commit: 0c0bc619181419a3005faf034706d77ef24457e6
Author: Julian Eisel
Date:   Mon Dec 7 13:54:11 2020 +0100
Branches: master
https://developer.blender.org/rB0c0bc619181419a3005faf034706d77ef24457e6

Fix access to invalid data in Outliner tree building

Non-ID tree-elements would cast their data pointer to `ID *` and take the name
and ID-Code from there. The name would actually be overridden a few lines
later, so that didn't cause issues. But the ID-Code stored inside the tree
element kept an undefined value. In practice that probably didn't cause many
issues either, since it's just an undefined value that was very unlikely to
take a valid 16-bit ID-code value, meaning ID-Code checks would simply fail as
they should. Further there typically are other checks to see if the element
actually represents an ID.
However, in theory this may have caused a few random crashes or
data-corruptions.

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

M	source/blender/editors/space_outliner/outliner_tree.c

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

diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c
index 37f748692f9..811aaa1ba2e 100644
--- a/source/blender/editors/space_outliner/outliner_tree.c
+++ b/source/blender/editors/space_outliner/outliner_tree.c
@@ -965,7 +965,7 @@ TreeElement *outliner_add_element(SpaceOutliner *space_outliner,
   else if (ELEM(type, TSE_RNA_STRUCT, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM)) {
     /* pass */
   }
-  else if (type == TSE_ANIM_DATA) {
+  else if (ELEM(type, TSE_ANIM_DATA, TSE_NLA, TSE_NLA_TRACK, TSE_DRIVER_BASE)) {
     /* pass */
   }
   else if (type == TSE_GP_LAYER) {
@@ -977,7 +977,13 @@ TreeElement *outliner_add_element(SpaceOutliner *space_outliner,
   else if (type == TSE_ID_BASE) {
     /* pass */
   }
+  else if (ELEM(type, TSE_KEYMAP, TSE_KEYMAP_ITEM)) {
+    /* pass */
+  }
   else {
+    /* Other cases must be caught above. */
+    BLI_assert(TSE_IS_REAL_ID(tselem));
+
     /* do here too, for blend file viewer, own ID_LI then shows file name */
     if (GS(id->name) == ID_LI) {
       te->name = ((Library *)id)->filepath;



More information about the Bf-blender-cvs mailing list