Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2022-04-14 21:04:16 +0300
committerHans Goudey <h.goudey@me.com>2022-04-14 21:04:23 +0300
commit05715eaea144b3812c2a788e5ef413a5aa601a06 (patch)
treed018a4648875b6c8fc5501e41c03e132fa6f6afc /source
parent80859a6cb2726a39fb22cb49f06e0355dc9390a7 (diff)
Fix: Use after free when removing attribute on instances
Assume that only one layer matches the id and return instead of continuing to iterate over attributes after the layers have been potentially reallocated.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/attribute_access.cc5
1 files changed, 2 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/attribute_access.cc b/source/blender/blenkernel/intern/attribute_access.cc
index d0420b4170a..0ae9fa4356b 100644
--- a/source/blender/blenkernel/intern/attribute_access.cc
+++ b/source/blender/blenkernel/intern/attribute_access.cc
@@ -746,15 +746,14 @@ bool CustomDataAttributes::create_by_move(const AttributeIDRef &attribute_id,
bool CustomDataAttributes::remove(const AttributeIDRef &attribute_id)
{
- bool result = false;
for (const int i : IndexRange(data.totlayer)) {
const CustomDataLayer &layer = data.layers[i];
if (custom_data_layer_matches_attribute_id(layer, attribute_id)) {
CustomData_free_layer(&data, layer.type, size_, i);
- result = true;
+ return true;
}
}
- return result;
+ return false;
}
void CustomDataAttributes::reallocate(const int size)