Verify first 4 bytes of TIFF file
Avoids Olympus Raw (ORF) false positive
This commit is contained in:
parent
9069b2f9ad
commit
7d94e81b7b
@ -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 );
|
||||
|
Loading…
Reference in New Issue
Block a user