thumbnail could fail on HEIC in some modes

in locked UP or DOWN mode, vips_thumbnail() could incorrectly select the
thumbnail from a HEIC image even when it was not large enough to
generate the output image.

Thanks ZorinArsenij

See https://github.com/libvips/libvips/issues/1614
This commit is contained in:
John Cupitt 2020-04-21 10:15:02 +01:00
parent 0897a77515
commit 6f0548dc5c
2 changed files with 8 additions and 3 deletions

View File

@ -5,6 +5,8 @@
- add fuzz corpus to dist
- detect read errors correctly in source_sniff
- fix regression in autorot [malomalo]
- thumbnail on HEIC images could select the thumbnail incorrectly under some
size modes [ZorinArsenij]
20/6/19 started 8.9.1
- don't use the new source loaders for new_from_file or new_from_buffer, it

View File

@ -495,15 +495,18 @@ vips_thumbnail_open( VipsThumbnail *thumbnail )
/* 'factor' is a gboolean which enables thumbnail load instead
* of image load.
*
* Use the thumbnail if, by using it, we could get a factor >=
* 1.0, ie. we would not need to expand the thumbnail.
* Use the thumbnail if, by using it, we could get a factor >
* 1.0, ie. we would not need to expand the thumbnail.
*
* Don't use >= since factor can be clipped to 1.0 under some
* resizing modes.
*/
double shrink_factor = vips_thumbnail_calculate_common_shrink(
thumbnail,
thumbnail->heif_thumbnail_width,
thumbnail->heif_thumbnail_height );
factor = shrink_factor >= 1.0 ? 1 : 0;
factor = shrink_factor > 1.0 ? 1 : 0;
}
g_info( "loading with factor %g pre-shrink", factor );