diff --git a/ChangeLog b/ChangeLog index 479bea6b..08cd9c19 100644 --- a/ChangeLog +++ b/ChangeLog @@ -21,6 +21,7 @@ master - fix null string in buffer print [pclewis] - revise caching of seq mode loaders [jcupitt] - reduce latency on dzsave kill [kleisauke] +- improve text too large check [kleisauke] 24/7/22 started 8.13.1 - fix im7 feature detection in meson diff --git a/libvips/create/text.c b/libvips/create/text.c index 2766f42f..3ac60db1 100644 --- a/libvips/create/text.c +++ b/libvips/create/text.c @@ -348,6 +348,7 @@ vips_text_build( VipsObject *object ) VipsImage *image; cairo_surface_t *surface; cairo_t *cr; + cairo_status_t status; if( VIPS_OBJECT_CLASS( vips_text_parent_class )->build( object ) ) return( -1 ); @@ -417,15 +418,6 @@ vips_text_build( VipsObject *object ) return( -1 ); } - /* Cairo can't go over 32k pixels. - */ - if( extents.width >= 32768 || - extents.height >= 32768 ) { - vips_error( class->nickname, - "%s", _( "text image too large" ) ); - return( -1 ); - } - image = t[0] = vips_image_new_memory(); vips_image_init_fields( image, extents.width, extents.height, 4, @@ -444,6 +436,15 @@ vips_text_build( VipsObject *object ) CAIRO_FORMAT_ARGB32, image->Xsize, image->Ysize, VIPS_IMAGE_SIZEOF_LINE( image ) ); + + status = cairo_surface_status( surface ); + if( status ) { + cairo_surface_destroy( surface ); + vips_error( class->nickname, + "%s", cairo_status_to_string( status ) ); + return( -1 ); + } + cr = cairo_create( surface ); cairo_surface_destroy( surface );