From 7d94e81b7b26dc34f03d10066b3528759361e7ef Mon Sep 17 00:00:00 2001 From: Lovell Fuller Date: Mon, 13 Oct 2014 11:40:28 +0100 Subject: [PATCH 1/3] Verify first 4 bytes of TIFF file Avoids Olympus Raw (ORF) false positive --- libvips/foreign/tiff2vips.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libvips/foreign/tiff2vips.c b/libvips/foreign/tiff2vips.c index 6e39a5f7..fe84780b 100644 --- a/libvips/foreign/tiff2vips.c +++ b/libvips/foreign/tiff2vips.c @@ -1904,9 +1904,9 @@ 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[0] == 'I' && str[1] == 'I' && str[2] == '*' && str[3] == '\0')) ) return( TRUE ); return( FALSE ); @@ -1915,10 +1915,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 ); From 75bf439d92bb20c42fa62020748cabe6ef83d3a3 Mon Sep 17 00:00:00 2001 From: Lovell Fuller Date: Mon, 13 Oct 2014 19:47:06 +0100 Subject: [PATCH 2/3] Support BigTIFF, thanks @bgilbert --- libvips/foreign/tiff2vips.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libvips/foreign/tiff2vips.c b/libvips/foreign/tiff2vips.c index fe84780b..35046d81 100644 --- a/libvips/foreign/tiff2vips.c +++ b/libvips/foreign/tiff2vips.c @@ -1905,8 +1905,10 @@ vips__istiff_buffer( void *buf, size_t len ) char *str = (char *) buf; if( len >= 4 && - ((str[0] == 'M' && str[1] == 'M' && str[2] == '\0' && str[3] == '*') || - (str[0] == 'I' && str[1] == 'I' && str[2] == '*' && str[3] == '\0')) ) + ((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 ); From 965936307b64c7ff7783f3f262a459670a41f7d9 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Mon, 27 Oct 2014 13:45:45 +0000 Subject: [PATCH 3/3] better bigtiff detection update Changelog and bump version --- ChangeLog | 3 +++ configure.ac | 6 +++--- libvips/foreign/tiff2vips.c | 2 ++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index d2ca0c82..85906a06 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +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/configure.ac b/configure.ac index 1ab7c907..cbe5a219 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ # also update the version number in the m4 macros below -AC_INIT([vips], [7.40.11], [vipsip@jiscmail.ac.uk]) +AC_INIT([vips], [7.40.12], [vipsip@jiscmail.ac.uk]) # required for gobject-introspection AC_PREREQ(2.62) @@ -18,7 +18,7 @@ AC_CONFIG_MACRO_DIR([m4]) # user-visible library versioning m4_define([vips_major_version], [7]) m4_define([vips_minor_version], [40]) -m4_define([vips_micro_version], [11]) +m4_define([vips_micro_version], [12]) m4_define([vips_version], [vips_major_version.vips_minor_version.vips_micro_version]) @@ -38,7 +38,7 @@ VIPS_VERSION_STRING=$VIPS_VERSION-`date` # binary interface changes not backwards compatible?: reset age to 0 LIBRARY_CURRENT=38 -LIBRARY_REVISION=7 +LIBRARY_REVISION=8 LIBRARY_AGE=0 # patched into include/vips/version.h diff --git a/libvips/foreign/tiff2vips.c b/libvips/foreign/tiff2vips.c index 35046d81..9ac0934a 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 */ /*