Skip to content

Commit c8363d4

Browse files
authored
Merge pull request libvips#2179 from lovell/nsgifload-limit-dimensions
nsgifload: enforce maximum GIF dimensions of 16383
2 parents e4453f8 + 701dcc7 commit c8363d4

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

libvips/foreign/nsgifload.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -534,17 +534,17 @@ vips_foreign_load_nsgif_class_init( VipsForeignLoadNsgifClass *class )
534534
static void *
535535
vips_foreign_load_nsgif_bitmap_create( int width, int height )
536536
{
537-
/* Check GIF dimensions fit within 16-bit unsigned.
537+
/* Enforce max GIF dimensions of 16383 (0x7FFF).
538538
*/
539539
if( width <= 0 ||
540-
width > 65535 ||
540+
width > 16383 ||
541541
height <= 0 ||
542-
height > 65535 ) {
542+
height > 16383 ) {
543543
vips_error( "gifload",
544-
"%s", _( "dimensions out of range ") );
544+
"%s", _( "bad image dimensions") );
545545
return( NULL );
546546
}
547-
return g_malloc0( width * height * 4 );
547+
return g_malloc0( (gsize) width * height * 4 );
548548
}
549549

550550
static void

0 commit comments

Comments
 (0)