This commit is contained in:
John Cupitt 2020-11-21 14:23:58 +00:00
parent 0e38b7b342
commit 414b849aef
1 changed files with 6 additions and 4 deletions

View File

@ -701,13 +701,15 @@ static int
vips_foreign_load_gif_set_header( VipsForeignLoadGif *gif, VipsImage *image ) vips_foreign_load_gif_set_header( VipsForeignLoadGif *gif, VipsImage *image )
{ {
const gint64 total_height = (gint64) gif->file->SHeight * gif->n; const gint64 total_height = (gint64) gif->file->SHeight * gif->n;
if ( total_height <= 0 || total_height > VIPS_MAX_COORD ) {
vips_error( "gifload", "%s", if( total_height <= 0 ||
_( "image size out of bounds" ) ); total_height > VIPS_MAX_COORD ) {
vips_error( "gifload", "%s", _( "image size out of bounds" ) );
return( -1 ); return( -1 );
} }
vips_image_init_fields( image, vips_image_init_fields( image,
gif->file->SWidth, (int) total_height, gif->file->SWidth, total_height,
(gif->has_colour ? 3 : 1) + (gif->has_transparency ? 1 : 0), (gif->has_colour ? 3 : 1) + (gif->has_transparency ? 1 : 0),
VIPS_FORMAT_UCHAR, VIPS_CODING_NONE, VIPS_FORMAT_UCHAR, VIPS_CODING_NONE,
gif->has_colour ? gif->has_colour ?