diff --git a/libvips/foreign/magickload.c b/libvips/foreign/magickload.c index 7cbc1518..96f72e36 100644 --- a/libvips/foreign/magickload.c +++ b/libvips/foreign/magickload.c @@ -10,6 +10,8 @@ * - add @page option, 0 by default * 25/11/16 * - add @n, deprecate @all_frames (just sets n = -1) + * 8/9/17 + * - don't cache magickload */ /* @@ -95,6 +97,7 @@ vips_foreign_load_magick_class_init( VipsForeignLoadMagickClass *class ) { GObjectClass *gobject_class = G_OBJECT_CLASS( class ); VipsObjectClass *object_class = (VipsObjectClass *) class; + VipsOperationClass *operation_class = VIPS_OPERATION_CLASS( class ); VipsForeignClass *foreign_class = (VipsForeignClass *) class; VipsForeignLoadClass *load_class = (VipsForeignLoadClass *) class; @@ -104,6 +107,10 @@ vips_foreign_load_magick_class_init( VipsForeignLoadMagickClass *class ) object_class->nickname = "magickload_base"; object_class->description = _( "load with ImageMagick" ); + /* Don't cache magickload: it can gobble up memory and disc. + */ + operation_class->flags = VIPS_OPERATION_NOCACHE; + /* We need to be well to the back of the queue since vips's * dedicated loaders are usually preferable. */ diff --git a/libvips/foreign/svgload.c b/libvips/foreign/svgload.c index 9c425506..bb3d96d0 100644 --- a/libvips/foreign/svgload.c +++ b/libvips/foreign/svgload.c @@ -8,6 +8,8 @@ * - invalidate operation on read error * 8/7/17 * - fix DPI mixup, thanks Fosk + * 9/9/17 + * - limit max tile width to 30k pixels to prevent overflow in render */ /* @@ -216,6 +218,7 @@ vips_foreign_load_svg_load( VipsForeignLoad *load ) int tile_width; int tile_height; int n_lines; + int max_tiles; /* Use this to pick a tile height for our strip cache. */ @@ -231,12 +234,19 @@ vips_foreign_load_svg_load( VipsForeignLoad *load ) NULL, vips_foreign_load_svg_generate, NULL, svg, NULL ) ) return( -1 ); - /* Don't use tilecache to keep the number of calls to - * rsvg_handle_render_cairo() low. Don't thread the cache, we rely on - * locking to keep rsvg single-threaded. + /* librsvg starts to fail if any axis in a single render call is over + * 32767. Use a tilecache so we can render very wide images, though we + * set it up like a linecache. + * + * Don't thread the cache: we rely on this to keep calls to rsvg + * single-threaded. */ - if( vips_linecache( t[0], &t[1], + max_tiles = 3 * VIPS_ROUND_UP( t[0]->Xsize, 30000 ) / 30000; + if( vips_tilecache( t[0], &t[1], + "tile_width", 30000, "tile_height", tile_height, + "max_tiles", max_tiles, + "access", VIPS_ACCESS_SEQUENTIAL, NULL ) ) return( -1 ); if( vips_image_write( t[1], load->real ) )