From 3ceec6682fcbf2169143a4f3e6adef50b4f248bb Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Mon, 5 Jan 2015 13:37:27 +0000 Subject: [PATCH] better error message from getpoint --- libvips/arithmetic/getpoint.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/libvips/arithmetic/getpoint.c b/libvips/arithmetic/getpoint.c index 76601f6a..166c0349 100644 --- a/libvips/arithmetic/getpoint.c +++ b/libvips/arithmetic/getpoint.c @@ -96,9 +96,18 @@ vips_getpoint_build( VipsObject *object ) if( VIPS_OBJECT_CLASS( vips_getpoint_parent_class )->build( object ) ) return( -1 ); + /* <0 ruled out already. + */ + if( getpoint->x >= getpoint->in->Xsize || + getpoint->y >= getpoint->in->Ysize ) { + vips_error( class->nickname, + "%s", _( "coordinates out of range" ) ); + return( -1 ); + } + if( vips_check_coding_known( class->nickname, getpoint->in ) || !(region = vips_region_new( getpoint->in )) ) - return( -1 ); + return( -1 ); area.left = getpoint->x; area.top = getpoint->y;