]> granicus.if.org Git - imagemagick/commitdiff
Handle zero ticks_per_second in accordance with MNG spec (set both
authorglennrp <glennrp@git.imagemagick.org>
Tue, 1 Jun 2010 13:07:15 +0000 (13:07 +0000)
committerglennrp <glennrp@git.imagemagick.org>
Tue, 1 Jun 2010 13:07:15 +0000 (13:07 +0000)
frame_delay and frame_timeout to PNG_UINT_31_MAX).

ChangeLog
coders/png.c

index 14203cc3893edbb7882111f092aeca4580ad5e44..deaae25768218e441a6e69366a6b7fa45d50ef5d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,9 @@
   * Add x:silent option to prevent beeps when reading the X image format.
   * Recognize TTF for GetMagicInfo().
   * Ensure the +set option deletes the image artifact.
+  * Prevent MNG divide by zero in calculation of frame_timeout.  Set
+    both frame_delay and frame_timeout to infinite when ticks_per_second
+    is zero, as required by the MNG spec.
 
 2010-05-28  6.6.2.1 Glenn Randers-Pehrson <glennrp@image...>
   * Prevent coders/png.c from attempting to write an empty tRNS chunk.
index c885642daea1d681bab4128e804fe493f522c25e..a7bd06dbb78f1ac3254f6894aba34c2c63d07146 100644 (file)
@@ -4457,6 +4457,8 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
                           mng_get_long(p);
                         if (mng_info->ticks_per_second != 0)
                           frame_delay/=mng_info->ticks_per_second;
+                        else
+                          frame_delay=PNG_UINT_31_MAX;
                         if (change_delay == 2)
                           default_frame_delay=frame_delay;
                         p+=4;
@@ -4466,8 +4468,12 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
                       }
                     if (change_timeout)
                       {
-                        frame_timeout=(1UL*image->ticks_per_second*
-                            (mng_get_long(p))/mng_info->ticks_per_second);
+                        frame_timeout=1UL*image->ticks_per_second*
+                          mng_get_long(p);
+                        if (mng_info->ticks_per_second != 0)
+                          frame_timeout/=mng_info->ticks_per_second;
+                        else
+                          frame_timeout=PNG_UINT_31_MAX;
                         if (change_delay == 2)
                           default_frame_timeout=frame_timeout;
                         p+=4;