From bdacde1ce7691880be5ee0b6324ed7e5580385f3 Mon Sep 17 00:00:00 2001 From: Dirk Lemstra Date: Thu, 23 Nov 2017 23:31:16 +0100 Subject: [PATCH] Proper fix for #875. --- coders/svg.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/coders/svg.c b/coders/svg.c index 69faeaaa7..c3e73415c 100644 --- a/coders/svg.c +++ b/coders/svg.c @@ -3081,8 +3081,11 @@ static Image *ReadSVGImage(const ImageInfo *image_info,ExceptionInfo *exception) cairo_surface=cairo_image_surface_create_for_data(pixels, CAIRO_FORMAT_ARGB32,(int) image->columns,(int) image->rows,(int) stride); - if (cairo_surface_status() != CAIRO_STATUS_SUCCESS) + if ((cairo_surface == (cairo_surface_t *) NULL) || + (cairo_surface_status(cairo_surface) != CAIRO_STATUS_SUCCESS)) { + if (cairo_surface != (cairo_surface_t *) NULL) + cairo_surface_destroy(cairo_surface); pixel_info=RelinquishVirtualMemory(pixel_info); g_object_unref(svg_handle); ThrowReaderException(ResourceLimitError, -- 2.50.1