Skip to content

Commit 5325742

Browse files
committed
heifsave: limit output dimensions to match max input dimensions
1 parent 3834a9f commit 5325742

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

libvips/foreign/heifsave.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,13 @@ vips_foreign_save_heif_build( VipsObject *object )
545545
heif->page_height = vips_image_get_page_height( heif->image );
546546
heif->n_pages = heif->image->Ysize / heif->page_height;
547547

548+
if( (guint64) heif->page_width * heif->page_height > INT_MAX / 4 ||
549+
heif->page_width > SHRT_MAX ||
550+
heif->page_height > SHRT_MAX ) {
551+
vips_error( "heifsave", _( "image too large" ) );
552+
return( -1 );
553+
}
554+
548555
/* Make a heif image the size of a page. We send sink_disc() output
549556
* here and write a frame each time it fills.
550557
*/

0 commit comments

Comments
 (0)