Merge pull request #2179 from lovell/nsgifload-limit-dimensions

nsgifload: enforce maximum GIF dimensions of 16383
This commit is contained in:
John Cupitt 2021-04-02 11:44:30 +01:00 committed by GitHub
commit c8363d4e61
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 5 deletions

View File

@ -534,17 +534,17 @@ vips_foreign_load_nsgif_class_init( VipsForeignLoadNsgifClass *class )
static void *
vips_foreign_load_nsgif_bitmap_create( int width, int height )
{
/* Check GIF dimensions fit within 16-bit unsigned.
/* Enforce max GIF dimensions of 16383 (0x7FFF).
*/
if( width <= 0 ||
width > 65535 ||
width > 16383 ||
height <= 0 ||
height > 65535 ) {
height > 16383 ) {
vips_error( "gifload",
"%s", _( "dimensions out of range ") );
"%s", _( "bad image dimensions") );
return( NULL );
}
return g_malloc0( width * height * 4 );
return g_malloc0( (gsize) width * height * 4 );
}
static void