Verify ISO/3GPP2 signature in heifload is_a check
This commit is contained in:
parent
58a327b7f9
commit
1922a97a85
|
@ -260,9 +260,15 @@ static const char *heif_magic[] = {
|
||||||
static int
|
static int
|
||||||
vips_foreign_load_heif_is_a( const char *buf, int len )
|
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 ) {
|
if( len >= 12 ) {
|
||||||
int i;
|
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++ )
|
for( i = 0; i < VIPS_NUMBER( heif_magic ); i++ )
|
||||||
if( strncmp( buf + 4, heif_magic[i], 8 ) == 0 )
|
if( strncmp( buf + 4, heif_magic[i], 8 ) == 0 )
|
||||||
return( 1 );
|
return( 1 );
|
||||||
|
|
Loading…
Reference in New Issue