diff --git a/ChangeLog b/ChangeLog index 8f6444c5..fe301f01 100644 --- a/ChangeLog +++ b/ChangeLog @@ -20,6 +20,9 @@ - added autorot operator - added @filter option to pngsave (Lovell) +27/10/14 started 7.40.12 +- better tiff detection (Lovell) + 8/10/14 started 7.40.11 - rework extra band handling for colour functions - set interpretation of matlut output more carefully diff --git a/libvips/foreign/tiff2vips.c b/libvips/foreign/tiff2vips.c index 89c4d1f2..5386f53a 100644 --- a/libvips/foreign/tiff2vips.c +++ b/libvips/foreign/tiff2vips.c @@ -148,6 +148,8 @@ * - add read from buffer * 30/4/14 * - 1/2/4 bit palette images can have alpha + * 27/10/14 Lovell + * - better istiff detector spots bigtiff */ /* @@ -1904,9 +1906,11 @@ vips__istiff_buffer( void *buf, size_t len ) { char *str = (char *) buf; - if( len >= 2 && - ((str[0] == 'M' && str[1] == 'M') || - (str[0] == 'I' && str[1] == 'I')) ) + if( len >= 4 && + ((str[0] == 'M' && str[1] == 'M' && + str[2] == '\0' && (str[3] == '*' || str[3] == '+')) || + (str[0] == 'I' && str[1] == 'I' && + (str[2] == '*' || str[2] == '+') && str[3] == '\0')) ) return( TRUE ); return( FALSE ); @@ -1915,10 +1919,10 @@ vips__istiff_buffer( void *buf, size_t len ) gboolean vips__istiff( const char *filename ) { - unsigned char buf[2]; + unsigned char buf[4]; - if( vips__get_bytes( filename, buf, 2 ) && - vips__istiff_buffer( buf, 2 ) ) + if( vips__get_bytes( filename, buf, 4 ) && + vips__istiff_buffer( buf, 4 ) ) return( TRUE ); return( FALSE );