Branch: refs/heads/master
  Home:   https://github.com/synfig/synfig
  Commit: 893c531a1fab065a6263c5e4155d1baf0525eb36
      
https://github.com/synfig/synfig/commit/893c531a1fab065a6263c5e4155d1baf0525eb36
  Author: rodolforg <rodolf...@users.noreply.github.com>
  Date:   2023-04-12 (Wed, 12 Apr 2023)

  Changed paths:
    M synfig-core/src/synfig/synfig_iterations.cpp

  Log Message:
  -----------
  fix: possible invalid memory access on replacing valuenodes (#3050)

As `dyn_param_list` is a reference to a vector, and the vector
can change in the loop, it can have invalid "iterators"/items.

Possible solutions:
1. `dyn_param_list` be a copy not a reference
2. Implement a `Layer::replace_dynamic_param()`
3. Store all the changes in another variable and postpone the actual
   changes until we finish the loop

The first one can create a "large" copy.

The second one is interesting, but I `git grep` the code and it does not
seem to be needed anywhere else XD The existent disconnections are for
replacing with a (static) ValueBase.

Therefore, I opted for the 3rd solution. It is lighter than option 1 and
less 'intrusive' than the second one.




_______________________________________________
Synfig-devl mailing list
Synfig-devl@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synfig-devl

Reply via email to