Fix misuse of ImageMagick that caused core dump.

* image.c (imagemagick_load_image): Calculate height and width
after flattening the image, not before.

Fixes: debbugs:13846
This commit is contained in:
Paul Eggert 2013-03-04 09:35:29 -08:00
parent 8bd104b35b
commit 84ac6f9d21
2 changed files with 11 additions and 5 deletions

View file

@ -1,3 +1,9 @@
2013-03-04 Paul Eggert <eggert@cs.ucla.edu>
Fix misuse of ImageMagick that caused core dump (Bug#13846).
* image.c (imagemagick_load_image): Calculate height and width
after flattening the image, not before.
2013-03-04 Dmitry Antipov <dmantipov@yandex.ru>
* font.c (Ffont_get_glyphs): Use convenient LGLYPH_NEW.

View file

@ -7792,11 +7792,6 @@ imagemagick_load_image (struct frame *f, struct image *img,
}
}
/* Finally we are done manipulating the image. Figure out the
resulting width/height and transfer ownership to Emacs. */
height = MagickGetImageHeight (image_wand);
width = MagickGetImageWidth (image_wand);
/* Set the canvas background color to the frame or specified
background, and flatten the image. Note: as of ImageMagick
6.6.0, SVG image transparency is not handled properly
@ -7813,6 +7808,11 @@ imagemagick_load_image (struct frame *f, struct image *img,
image_wand = new_wand;
}
/* Finally we are done manipulating the image. Figure out the
resulting width/height and transfer ownership to Emacs. */
height = MagickGetImageHeight (image_wand);
width = MagickGetImageWidth (image_wand);
if (! (width <= INT_MAX && height <= INT_MAX
&& check_image_size (f, width, height)))
{