diff options
Diffstat (limited to 'source/blender/imbuf/intern/tiff.c')
-rw-r--r-- | source/blender/imbuf/intern/tiff.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/source/blender/imbuf/intern/tiff.c b/source/blender/imbuf/intern/tiff.c index 69c1c6b596c..587d6ad9e7e 100644 --- a/source/blender/imbuf/intern/tiff.c +++ b/source/blender/imbuf/intern/tiff.c @@ -316,10 +316,13 @@ static TIFF *imb_tiff_client_open(ImbTIFFMemFile *memFile, const unsigned char * * hence my manual comparison. - Jonathan Merritt (lancelet) 4th Sept 2005. */ #define IMB_TIFF_NCB 4 /* number of comparison bytes used */ -bool imb_is_a_tiff(const unsigned char *buf, size_t UNUSED(size)) +bool imb_is_a_tiff(const unsigned char *buf, size_t size) { const char big_endian[IMB_TIFF_NCB] = {0x4d, 0x4d, 0x00, 0x2a}; const char lil_endian[IMB_TIFF_NCB] = {0x49, 0x49, 0x2a, 0x00}; + if (size < IMB_TIFF_NCB) { + return false; + } return ((memcmp(big_endian, buf, IMB_TIFF_NCB) == 0) || (memcmp(lil_endian, buf, IMB_TIFF_NCB) == 0)); |