From d80ce4bf15936d7d6c35159b0eb3fe3207b8b89a Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Tue, 13 Aug 2019 11:21:01 +0100 Subject: [PATCH] fix a problem with shrinkv tail processing Tail processing in shrinkv had an implicit assumption of round-down, but of course we round to nearest. Thanks angelmixu. see https://github.com/libvips/libvips/issues/1396 --- ChangeLog | 1 + libvips/resample/shrinkv.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 46b42970..02cf7e4c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,7 @@ - fix build with GM - add locks for pdfium load - fix build with MSVC +- fix a problem with shinkv tail processing [angelmixu] 24/5/19 started 8.8.1 - improve realpath() use on older libc diff --git a/libvips/resample/shrinkv.c b/libvips/resample/shrinkv.c index 0dfac96b..19925c32 100644 --- a/libvips/resample/shrinkv.c +++ b/libvips/resample/shrinkv.c @@ -329,12 +329,12 @@ vips_shrinkv_gen( VipsRegion *or, void *vseq, r->top + r->height >= or->im->Ysize ) { /* First unused scanline. resample->in->Ysize because we want * the height before the embed. + * + * Because we round to nearest, unused can be negative. */ int first = or->im->Ysize * shrink->vshrink; int unused = resample->in->Ysize - first; - g_assert( unused >= 0 ); - for( y = 0; y < unused; y++ ) { VipsRect s;