From 8ab6ef30ab28e6c73fc9309c0b21ddbc1cd3afc9 Mon Sep 17 00:00:00 2001 From: Richard Antalik Date: Sat, 2 Nov 2019 20:29:59 -0700 Subject: Fix T68018: Crash on building movie proxy Skip building proxy if directory can not be created. Crash happens, when setting custom dir to location of source file itself. This results in attempt to create directory with the same name as source file. Differential Revision: https://developer.blender.org/D6148 Reviewed By: sergey --- source/blender/imbuf/intern/indexer.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'source/blender/imbuf/intern/indexer.c') diff --git a/source/blender/imbuf/intern/indexer.c b/source/blender/imbuf/intern/indexer.c index 97a0cc85301..46095b7eedc 100644 --- a/source/blender/imbuf/intern/indexer.c +++ b/source/blender/imbuf/intern/indexer.c @@ -366,7 +366,7 @@ void IMB_anim_get_fname(struct anim *anim, char *file, int size) BLI_strncpy(file, fname, size); } -static void get_proxy_filename(struct anim *anim, +static bool get_proxy_filename(struct anim *anim, IMB_Proxy_Size preview_size, char *fname, bool temp) @@ -393,7 +393,12 @@ static void get_proxy_filename(struct anim *anim, get_index_dir(anim, index_dir, sizeof(index_dir)); + if (BLI_path_ncmp(anim->name, index_dir, FILE_MAXDIR) == 0) { + return false; + } + BLI_join_dirfile(fname, FILE_MAXFILE + FILE_MAXDIR, index_dir, proxy_name); + return true; } static void get_tc_filename(struct anim *anim, IMB_Timecode_Type tc, char *fname) @@ -1154,8 +1159,9 @@ IndexBuildContext *IMB_anim_index_rebuild_context(struct anim *anim, IMB_Proxy_Size proxy_size = proxy_sizes[i]; if (proxy_size & proxy_sizes_to_build) { char filename[FILE_MAX]; - get_proxy_filename(anim, proxy_size, filename, false); - + if (get_proxy_filename(anim, proxy_size, filename, false) == false) { + return NULL; + } void **filename_key_p; if (!BLI_gset_ensure_p_ex(file_list, filename, &filename_key_p)) { *filename_key_p = BLI_strdup(filename); @@ -1176,7 +1182,9 @@ IndexBuildContext *IMB_anim_index_rebuild_context(struct anim *anim, IMB_Proxy_Size proxy_size = proxy_sizes[i]; if (proxy_size & built_proxies) { char filename[FILE_MAX]; - get_proxy_filename(anim, proxy_size, filename, false); + if (get_proxy_filename(anim, proxy_size, filename, false) == false) { + return NULL; + } printf("Skipping proxy: %s\n", filename); } } -- cgit v1.2.3