forked from bartvdbraak/blender
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.
This commit is contained in:
parent
cb3005c263
commit
6d011d0e27
@ -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;
|
||||
}
|
||||
|
||||
|
@ -173,4 +173,14 @@ TEST(cryptomatte, session_from_stamp_data)
|
||||
RE_FreeRenderResult(render_result2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method that contains known malformed manifests and makes sure that these can be parsed as
|
||||
* best as possible. */
|
||||
TEST(cryptomatte, parsing_malformed_manifests)
|
||||
{
|
||||
/* Manifest from multilayer.exr in the cryptomatte git-repository. */
|
||||
test_cryptomatte_manifest(
|
||||
R"({"/obj/instance1:instances:0":"0d54c6cc","/obj/instance1:instances:1":"293d9340","/obj/instance1:instances:110":"ccb9e1f2","/obj/instance1:instances:111":"f8dd3a48","/obj/instance1:instances:112":"a99e07a8","/obj/instance1:instances:113":"e75599a4","/obj/instance1:instances:114":"794200f3","/obj/instance1:instances:115":"2a3a1728","/obj/instance1:instances:116":"478544a1","/obj/instance1:instances:117":"b2bd969a","/obj/instance1:instances:10":"3a0c8681","/obj/instance1:instances:11":"01e5970d","/obj/box:polygons:1":"9d416418","/obj/instance1:instances:100":"2dcd2966","/obj/instance1:instances:101":"9331cd82","/obj/instance1:instances:102":"df50fccb","/obj/instance1:instances:103":"97f8590d","/obj/instance1:instances:104":"bbcd220d","/obj/instance1:instances:105":"4ae06139","/obj/instance1:instances:106":"8873d5ea","/obj/instance1:instances:107":"39d8af8d","/obj/instance1:instances:108":"bb11bd4e","/obj/instance1:instances:109":"a32bba35"})",
|
||||
R"({"\/obj\/box:polygons:1":"9d416418","\/obj\/instance1:instances:0":"0d54c6cc","\/obj\/instance1:instances:1":"293d9340","\/obj\/instance1:instances:10":"3a0c8681","\/obj\/instance1:instances:100":"2dcd2966","\/obj\/instance1:instances:101":"9331cd82","\/obj\/instance1:instances:102":"df50fccb","\/obj\/instance1:instances:103":"97f8590d","\/obj\/instance1:instances:104":"bbcd220d","\/obj\/instance1:instances:105":"4ae06139","\/obj\/instance1:instances:106":"8873d5ea","\/obj\/instance1:instances:107":"39d8af8d","\/obj\/instance1:instances:108":"bb11bd4e","\/obj\/instance1:instances:109":"a32bba35","\/obj\/instance1:instances:11":"01e5970d","\/obj\/instance1:instances:110":"ccb9e1f2","\/obj\/instance1:instances:111":"f8dd3a48","\/obj\/instance1:instances:112":"a99e07a8","\/obj\/instance1:instances:113":"e75599a4","\/obj\/instance1:instances:114":"794200f3","\/obj\/instance1:instances:115":"2a3a1728","\/obj\/instance1:instances:116":"478544a1","\/obj\/instance1:instances:117":"b2bd969a","\/obj\/instance1:instance)");
|
||||
}
|
||||
} // namespace blender::bke::cryptomatte::tests
|
||||
|
Loading…
Reference in New Issue
Block a user