diff options
author | Dalai Felinto <dalai@blender.org> | 2021-09-27 16:05:23 +0300 |
---|---|---|
committer | Dalai Felinto <dalai@blender.org> | 2021-09-28 11:23:13 +0300 |
commit | a64782b1334118d1bd98c78f665e7e0bfd232076 (patch) | |
tree | f140b883ca1d2229a03e3e860877100bfe4568aa /source/blender/blenkernel/intern | |
parent | 7cd43a9d2887cffa8b2c24aa0d51f1e87a70e701 (diff) |
VSE: Implement sanity check for files with more channels than supported
This is a follow up to 8fecc2a8525467ee2fbbaae16ddbbc10b3050d46.
This makes sure future .blend files that have more channels than the
limit won't break Blender.
It can be backported to LTS.
This is part of https://developer.blender.org/D12645
Differential Revision: https://developer.blender.org/D12648
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/scene.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index ccd3e0bfd6c..1dd7fcf1d1a 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -63,6 +63,8 @@ #include "BLI_threads.h" #include "BLI_utildefines.h" +#include "BLO_readfile.h" + #include "BLT_translation.h" #include "BKE_action.h" @@ -993,8 +995,13 @@ static void link_recurs_seq(BlendDataReader *reader, ListBase *lb) { BLO_read_list(reader, lb); - LISTBASE_FOREACH (Sequence *, seq, lb) { - if (seq->seqbase.first) { + LISTBASE_FOREACH_MUTABLE (Sequence *, seq, lb) { + /* Sanity check. */ + if ((seq->machine < 1) || (seq->machine > MAXSEQ)) { + BLI_freelinkN(lb, seq); + BLO_read_data_reports(reader)->count.vse_strips_skipped++; + } + else if (seq->seqbase.first) { link_recurs_seq(reader, &seq->seqbase); } } |