diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-07-11 08:38:47 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-07-11 08:38:47 +0400 |
commit | b035ce3a82a3d8ff2f2eb876d3bb3cc266f83ab7 (patch) | |
tree | df0b92b74af1b7eefbbc1ab6d545cb0480433fd0 /source/blender | |
parent | 7fec23ae0a88ff4e6383d33574936bb37ca44763 (diff) |
fix [#36089] crash when using a tiff without TIFFTAG_EXTRASAMPLES
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/imbuf/intern/tiff.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/source/blender/imbuf/intern/tiff.c b/source/blender/imbuf/intern/tiff.c index 2630aebef3b..eaba04c9310 100644 --- a/source/blender/imbuf/intern/tiff.c +++ b/source/blender/imbuf/intern/tiff.c @@ -532,6 +532,7 @@ ImBuf *imb_loadtiff(unsigned char *mem, size_t size, int flags, char colorspace[ int level; short spp; int ib_depth; + int found; /* check whether or not we have a TIFF file */ if (size < IMB_TIFF_NCB) { @@ -575,10 +576,11 @@ ImBuf *imb_loadtiff(unsigned char *mem, size_t size, int flags, char colorspace[ if (spp == 4) { unsigned short extra, *extraSampleTypes; - TIFFGetField(image, TIFFTAG_EXTRASAMPLES, &extra, &extraSampleTypes); + found = TIFFGetField(image, TIFFTAG_EXTRASAMPLES, &extra, &extraSampleTypes); - if (extraSampleTypes[0] == EXTRASAMPLE_ASSOCALPHA) + if (found && (extraSampleTypes[0] == EXTRASAMPLE_ASSOCALPHA)) { ibuf->flags |= IB_alphamode_premul; + } } } |