Commit: fda50625cd099b4e65b5e82c7c9a48af256b45fd
Author: Jeroen Bakker
Date:   Fri Mar 26 09:08:24 2021 +0100
Branches: master
https://developer.blender.org/rBfda50625cd099b4e65b5e82c7c9a48af256b45fd

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":"'.

===================================================================

M       source/blender/blenkernel/intern/cryptomatte.cc

===================================================================

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);

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to