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:
authorJeroen Bakker <jeroen@blender.org>2021-03-26 11:08:24 +0300
committerJeroen Bakker <jeroen@blender.org>2021-03-26 11:13:46 +0300
commitfda50625cd099b4e65b5e82c7c9a48af256b45fd (patch)
tree0f1cf5ecd36f6c62cdc3454e566a9f3853fe5649 /source/blender/blenkernel/intern/cryptomatte.cc
parent4425bacec4d639fdc53f4cb8a6817326622b27b7 (diff)
Cryptomatte: Fix error loading incomplete metadata.
When rendering with cycles at some point the manifest is trimmed. This leads to incomplete/corrupted metadata. This patch will make sure that the manifest parser doesn't crash. This solved the issue when the manifest is trimmed at the start of a hash. Eg '"Name":"'.
Diffstat (limited to 'source/blender/blenkernel/intern/cryptomatte.cc')
-rw-r--r--source/blender/blenkernel/intern/cryptomatte.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/cryptomatte.cc b/source/blender/blenkernel/intern/cryptomatte.cc
index bc89fa85cea..99f0342e223 100644
--- a/source/blender/blenkernel/intern/cryptomatte.cc
+++ b/source/blender/blenkernel/intern/cryptomatte.cc
@@ -425,6 +425,9 @@ static bool from_manifest(CryptomatteLayer &layer, blender::StringRefNull manife
}
const int quoted_hash_len = quoted_string_len_(ref);
+ if (quoted_hash_len < 2) {
+ return false;
+ }
const int hash_len = quoted_hash_len - 2;
CryptomatteHash hash = CryptomatteHash::from_hex_encoded(ref.substr(1, hash_len));
ref = ref.drop_prefix(quoted_hash_len);