]> granicus.if.org Git - imagemagick/commitdiff
Assert image page dimension in OptimizeLayerFrames (#990)
authorAkihiko Odaki <akihiko.odaki.4i@stu.hosei.ac.jp>
Mon, 19 Feb 2018 20:03:00 +0000 (05:03 +0900)
committerImageMagick <urban-warrior@users.noreply.github.com>
Mon, 19 Feb 2018 20:03:00 +0000 (15:03 -0500)
OptimizeLayerFrames initializes the background with some assumptions for
image page dimension.

MagickCore/layer.c
config/english.xml

index c744243118c1ba76b076dcc7f4b8ad636cfd825d..2fb707f127ae643cda4284333131449d0078ec49 100644 (file)
@@ -962,10 +962,11 @@ static Image *OptimizeLayerFrames(const Image *image,
   {
     if ((curr->columns != image->columns) || (curr->rows != image->rows))
       ThrowImageException(OptionError,"ImagesAreNotTheSameSize");
-    /*
-      FUTURE: also check that image is also fully coalesced (full page)
-      Though as long as they are the same size it should not matter.
-    */
+
+    if ((curr->page.x != 0) || (curr->page.y != 0) ||
+        (curr->page.width != image->page.width) ||
+        (curr->page.height != image->page.height))
+      ThrowImageException(OptionError,"ImagePagesAreNotCoalesced");
   }
   /*
     Allocate memory (times 2 if we allow the use of frame duplications)
index 535691254af13ae476eb3a6875c8b2576f359086..69e6ddb447fb2328a3e2c325e89314d991ad4c27 100644 (file)
         <message name="ImagesAreNotTheSameSize">
           images are not the same size
         </message>
+        <message name="ImagePagesAreNotCoalesced">
+          image pages are not coalesced
+        </message>
         <message name="ImageSizeMustExceedBevelWidth">
           size must exceed bevel width
         </message>