Verify ISO/3GPP2 signature in heifload is_a check

This commit is contained in:
Lovell Fuller 2020-09-22 21:19:53 +01:00 committed by John Cupitt
parent ffe574399e
commit 553eb73965
1 changed files with 6 additions and 0 deletions

View File

@ -260,9 +260,15 @@ 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 )
return ( 0 );
for( i = 0; i < VIPS_NUMBER( heif_magic ); i++ )
if( strncmp( buf + 4, heif_magic[i], 8 ) == 0 )
return( 1 );