[Bf-blender-cvs] [46c40d7fa1e] master: Fix: Use after free in geometry node group logger

Hans Goudey noreply at git.blender.org
Thu Oct 6 18:59:06 CEST 2022


Commit: 46c40d7fa1ec6fd230acb0b1e1f6cd01a32a05d2
Author: Hans Goudey
Date:   Thu Oct 6 11:48:05 2022 -0500
Branches: master
https://developer.blender.org/rB46c40d7fa1ec6fd230acb0b1e1f6cd01a32a05d2

Fix: Use after free in geometry node group logger

The name of the node group in the geometry nodes logger is created
in `GeoModifierLog::get_local_tree_logger`, where it references the
compute context. However, the compute context is a local variable
that doesn't live as long as the log. Therefore the log needs to own
the node group name.

Removing the ownership from `NodeGroupComputeContext` may be
possible as well, but seems less obviously correct. This can be a
temporary solution until we can completely avoid storing strings
in the logger (see D15775).

Fixes T101599

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

M	source/blender/nodes/NOD_geometry_nodes_log.hh

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

diff --git a/source/blender/nodes/NOD_geometry_nodes_log.hh b/source/blender/nodes/NOD_geometry_nodes_log.hh
index 2b0c16c8656..5a2203a76b7 100644
--- a/source/blender/nodes/NOD_geometry_nodes_log.hh
+++ b/source/blender/nodes/NOD_geometry_nodes_log.hh
@@ -169,7 +169,7 @@ using TimePoint = Clock::time_point;
 class GeoTreeLogger {
  public:
   std::optional<ComputeContextHash> parent_hash;
-  std::optional<StringRefNull> group_node_name;
+  std::optional<std::string> group_node_name;
   Vector<ComputeContextHash> children_hashes;
 
   LinearAllocator<> *allocator = nullptr;



More information about the Bf-blender-cvs mailing list