Page MenuHome

Fix T89436: use-after-free creating nodelinks in certain scenarios
AbandonedPublic

Authored by Philipp Oeser (lichtwerk) on Jun 29 2021, 2:00 PM.

Details

Summary

When creating nodelinks from python to a group extension socket, freed
memory could be used.

This is because since rB513066e8ad6f, just created links could be
removed and recreated again if extension sockets are involved. This is
not a problem in itself, but this links 'tonode' was accessed - we can
use other available 'tonode' though, this should be the same.

Diff Detail

Repository
rB Blender
Branch
T89436 (branched from master)
Build Status
Buildable 15485
Build 15485: arc lint + arc unit

Event Timeline

Philipp Oeser (lichtwerk) requested review of this revision.Jun 29 2021, 2:00 PM
Philipp Oeser (lichtwerk) created this revision.
Jacques Lucke (JacquesLucke) requested changes to this revision.Jun 29 2021, 2:16 PM

I should mention that it is generally discouraged to link to these sockets directly. Better use e.g node_group.inputs.new beforehand.

It still seems wrong that ret is returned even though it has been freed, if I understand correctly.

source/blender/makesrna/intern/rna_nodetree.c
1313

Missing ..

This revision now requires changes to proceed.Jun 29 2021, 2:16 PM

It still seems wrong that ret is returned even though it has been freed, if I understand correctly.

Hm, true, that should be fixed as well I guess

Not sure if I read node_group_output_update correctly, but at this point I am unsure on how to reliably return something valid in this case.

I tried getting the new link with

ret = nodeFindLink(ntree, fromsock, tosock);

after nodeUpdate and ntreeUpdateTree have run but that wont find a link. Possibly the sockets are not valid anymore either?

Think this is not even an issue anymore in newer versions