reducev: Fix undefined-behaviour within the vector path
Found by UBSan.
This commit is contained in:
parent
ac30bad695
commit
d7a735400a
@ -653,10 +653,9 @@ vips_reducev_vector_gen( VipsRegion *out_region, void *vseq,
|
|||||||
#endif /*DEBUG_PIXELS*/
|
#endif /*DEBUG_PIXELS*/
|
||||||
|
|
||||||
s.left = r->left;
|
s.left = r->left;
|
||||||
s.top = r->top * reducev->vshrink;
|
s.top = r->top * reducev->vshrink - reducev->voffset;
|
||||||
s.width = r->width;
|
s.width = r->width;
|
||||||
s.height = r->height * reducev->vshrink + reducev->n_point -
|
s.height = r->height * reducev->vshrink + reducev->n_point;
|
||||||
reducev->voffset;
|
|
||||||
if( vips_region_prepare( ir, &s ) )
|
if( vips_region_prepare( ir, &s ) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
|
|
||||||
|
@ -82,9 +82,8 @@ class TestResample:
|
|||||||
|
|
||||||
for fac in [1, 1.1, 1.5, 1.999]:
|
for fac in [1, 1.1, 1.5, 1.999]:
|
||||||
for fmt in all_formats:
|
for fmt in all_formats:
|
||||||
# TODO: Add nearest kernel when https://github.com/libvips/libvips/issues/1518 is done.
|
for kernel in ["nearest", "linear",
|
||||||
# (running the test suite with VIPS_NOVECTOR=1 should also work)
|
"cubic", "lanczos2", "lanczos3"]:
|
||||||
for kernel in ["linear", "cubic", "lanczos2", "lanczos3"]:
|
|
||||||
x = im.cast(fmt)
|
x = im.cast(fmt)
|
||||||
r = x.reduce(fac, fac, kernel=kernel)
|
r = x.reduce(fac, fac, kernel=kernel)
|
||||||
d = abs(r.avg() - im.avg())
|
d = abs(r.avg() - im.avg())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user