diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-06-17 08:53:35 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-06-17 08:53:35 +0300 |
commit | 5b833de521f26c6f4af2e852ccf420f3661fb02a (patch) | |
tree | 8ff848ff532d8655fc4e9921d920a7007cb877a6 /source/blender/imbuf/intern | |
parent | c03dcc5421e2115ad48d0d407dd57a50a30793a1 (diff) |
ImBuf: Assert when read/write gets relative paths
We _never_ want this, so better not fail silently.
Diffstat (limited to 'source/blender/imbuf/intern')
-rw-r--r-- | source/blender/imbuf/intern/anim_movie.c | 2 | ||||
-rw-r--r-- | source/blender/imbuf/intern/readimage.c | 4 | ||||
-rw-r--r-- | source/blender/imbuf/intern/util.c | 10 | ||||
-rw-r--r-- | source/blender/imbuf/intern/writeimage.c | 6 |
4 files changed, 19 insertions, 3 deletions
diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c index 185dadc0592..2c8431d25ea 100644 --- a/source/blender/imbuf/intern/anim_movie.c +++ b/source/blender/imbuf/intern/anim_movie.c @@ -271,6 +271,8 @@ struct anim *IMB_open_anim(const char *name, int ib_flags, int streamindex, char { struct anim *anim; + BLI_assert(!BLI_path_is_rel(name)); + anim = (struct anim *)MEM_callocN(sizeof(struct anim), "anim struct"); if (anim != NULL) { if (colorspace) { diff --git a/source/blender/imbuf/intern/readimage.c b/source/blender/imbuf/intern/readimage.c index 3cf123fbc28..38d54e64035 100644 --- a/source/blender/imbuf/intern/readimage.c +++ b/source/blender/imbuf/intern/readimage.c @@ -209,6 +209,8 @@ ImBuf *IMB_loadiffname(const char *filepath, int flags, char colorspace[IM_MAX_S int file, a; char filepath_tx[IB_FILENAME_SIZE]; + BLI_assert(!BLI_path_is_rel(filepath)); + imb_cache_filename(filepath_tx, filepath, flags); file = BLI_open(filepath_tx, O_BINARY | O_RDONLY, 0); @@ -237,6 +239,8 @@ ImBuf *IMB_testiffname(const char *filepath, int flags) char filepath_tx[IB_FILENAME_SIZE]; char colorspace[IM_MAX_SPACE] = "\0"; + BLI_assert(!BLI_path_is_rel(filepath)); + imb_cache_filename(filepath_tx, filepath, flags); file = BLI_open(filepath_tx, O_BINARY | O_RDONLY, 0); diff --git a/source/blender/imbuf/intern/util.c b/source/blender/imbuf/intern/util.c index 77962d43470..8b16e03aed2 100644 --- a/source/blender/imbuf/intern/util.c +++ b/source/blender/imbuf/intern/util.c @@ -190,7 +190,9 @@ int IMB_ispic_type(const char *name) BLI_stat_t st; int fp; - if (UTIL_DEBUG) printf("IMB_ispic_name: loading %s\n", name); + BLI_assert(!BLI_path_is_rel(name)); + + if (UTIL_DEBUG) printf("%s: loading %s\n", __func__, name); if (BLI_stat(name, &st) == -1) return false; @@ -389,7 +391,9 @@ int imb_get_anim_type(const char *name) int type; BLI_stat_t st; - if (UTIL_DEBUG) printf("in getanimtype: %s\n", name); + BLI_assert(!BLI_path_is_rel(name)); + + if (UTIL_DEBUG) printf("%s: %s\n", __func__, name); #ifndef _WIN32 # ifdef WITH_QUICKTIME @@ -434,7 +438,7 @@ int imb_get_anim_type(const char *name) bool IMB_isanim(const char *filename) { int type; - + type = imb_get_anim_type(filename); return (type && type != ANIM_SEQUENCE); diff --git a/source/blender/imbuf/intern/writeimage.c b/source/blender/imbuf/intern/writeimage.c index 2f688803804..28710fba823 100644 --- a/source/blender/imbuf/intern/writeimage.c +++ b/source/blender/imbuf/intern/writeimage.c @@ -33,6 +33,10 @@ #include <stdio.h> +#include <stdlib.h> + +#include "BLI_utildefines.h" +#include "BLI_path_util.h" #include "IMB_imbuf_types.h" #include "IMB_imbuf.h" @@ -50,6 +54,8 @@ short IMB_saveiff(struct ImBuf *ibuf, const char *name, int flags) { const ImFileType *type; + BLI_assert(!BLI_path_is_rel(name)); + if (ibuf == NULL) return (false); ibuf->flags = flags; |