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
diff options
context:
space:
mode:
authorBastien Montagne <bastien@blender.org>2021-05-27 12:53:44 +0300
committerBastien Montagne <bastien@blender.org>2021-05-27 12:55:31 +0300
commit42fba7f0d23901ff10ad8d076901decc0fb97d56 (patch)
tree294ec704ea096d85701814b591efcac8b334d18b
parentac2266fe57bc04845f61bf131cd416797721eff9 (diff)
LibOverride: Add heuristic protection against infinite loop due to libraries inter-dependencies.
This is not supposed to happen, but better be safe than sorry, and assume it is beyond unlikely that someone would use chains of over 10k linked libraries.
-rw-r--r--source/blender/blenkernel/intern/lib_override.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/lib_override.c b/source/blender/blenkernel/intern/lib_override.c
index e16a9081b35..aa7dfdf2bfa 100644
--- a/source/blender/blenkernel/intern/lib_override.c
+++ b/source/blender/blenkernel/intern/lib_override.c
@@ -1286,6 +1286,17 @@ static int lib_override_sort_libraries_func(LibraryIDLinkCallbackData *cb_data)
ID *id = *cb_data->id_pointer;
if (id != NULL && ID_IS_LINKED(id) && id->lib != id_owner->lib) {
const int owner_library_indirect_level = id_owner->lib != NULL ? id_owner->lib->temp_index : 0;
+ if (owner_library_indirect_level > 10000) {
+ CLOG_ERROR(
+ &LOG,
+ "Levels of indirect usages of libraries is way too high, skipping further building "
+ "loops (Involves at least '%s' and '%s')",
+ id_owner->lib->filepath,
+ id->lib->filepath);
+ BLI_assert(0);
+ return IDWALK_RET_NOP;
+ }
+
if (owner_library_indirect_level >= id->lib->temp_index) {
id->lib->temp_index = owner_library_indirect_level + 1;
*(bool *)cb_data->user_data = true;