prevent /0 in freq mask for very small masks

see https://github.com/libvips/libvips/issues/1236
This commit is contained in:
John Cupitt 2019-02-20 15:15:50 +00:00
parent 2fb81b8ed6
commit 65a259a025

View File

@ -58,8 +58,11 @@ vips_mask_point( VipsPoint *point, int x, int y )
{
VipsMask *mask = VIPS_MASK( point );
VipsMaskClass *class = VIPS_MASK_GET_CLASS( point );
int half_width = point->width / 2;
int half_height = point->height / 2;
/* VIPS_MAX to prevent /0.
*/
int half_width = VIPS_MAX( point->width / 2, 1 );
int half_height = VIPS_MAX( point->height / 2, 1 );
double result;