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-16 12:09:35 +0300
committerJeroen Bakker <jeroen@blender.org>2021-03-16 12:12:03 +0300
commit6d011d0e27d79b9c9fc7570770f5af958706e63a (patch)
tree9036203e1a9a5050114cdfccaebbbb871b9d588b /source/blender/blenkernel/intern/cryptomatte.cc
parentcb3005c2633dc3bea328b67a075709a8a1824fdd (diff)
Fix: Cryptomatte load corrupt manifests.
Seems like one of the example files on the cryptomatte github is malformed and blender crashes when loading that file. This change will try to load as much as possible from the manifest so it can still be used. This has also been reported to cryptomatte project.
Diffstat (limited to 'source/blender/blenkernel/intern/cryptomatte.cc')
-rw-r--r--source/blender/blenkernel/intern/cryptomatte.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/cryptomatte.cc b/source/blender/blenkernel/intern/cryptomatte.cc
index 74576b8bbbb..bc89fa85cea 100644
--- a/source/blender/blenkernel/intern/cryptomatte.cc
+++ b/source/blender/blenkernel/intern/cryptomatte.cc
@@ -410,6 +410,9 @@ static bool from_manifest(CryptomatteLayer &layer, blender::StringRefNull manife
ref = ref.drop_prefix(quoted_name_len);
ref = skip_whitespaces_(ref);
+ if (ref.is_empty()) {
+ return false;
+ }
char colon = ref.front();
if (colon != ':') {
return false;
@@ -417,7 +420,7 @@ static bool from_manifest(CryptomatteLayer &layer, blender::StringRefNull manife
ref = ref.drop_prefix(1);
ref = skip_whitespaces_(ref);
- if (ref.front() != '\"') {
+ if (ref.is_empty() || ref.front() != '\"') {
return false;
}