heifload: simplify is_a check of first 4 bytes

Allow multiples of 4, up to 32, as chunk length
This commit is contained in:
Lovell Fuller 2020-09-23 15:39:33 +01:00 committed by John Cupitt
parent e4b711a358
commit b6276dd44d
1 changed files with 2 additions and 5 deletions

View File

@ -260,14 +260,11 @@ static const char *heif_magic[] = {
static int
vips_foreign_load_heif_is_a( const char *buf, int len )
{
static unsigned char iso[4] = { 0, 0, 0, 24 };
static unsigned char three_gp[4] = { 0, 0, 0, 32 };
if( len >= 12 ) {
int i;
if( memcmp( buf, iso, 4 ) != 0 &&
memcmp( buf, three_gp, 4 ) != 0 )
const guint32 chunk_len = GUINT_FROM_BE( *buf );
if( chunk_len > 32 || chunk_len % 4 != 0 )
return ( 0 );
for( i = 0; i < VIPS_NUMBER( heif_magic ); i++ )