emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r112562: * image.c (gif_load): Check


From: Paul Eggert
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r112562: * image.c (gif_load): Check that subimages fit.
Date: Sun, 12 May 2013 12:17:04 -0700
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 112562
fixes bug: http://debbugs.gnu.org/14345
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Sun 2013-05-12 12:17:04 -0700
message:
  * image.c (gif_load): Check that subimages fit.
modified:
  src/ChangeLog
  src/image.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2013-05-09 18:30:46 +0000
+++ b/src/ChangeLog     2013-05-12 19:17:04 +0000
@@ -1,3 +1,7 @@
+2013-05-12  Paul Eggert  <address@hidden>
+
+       * image.c (gif_load): Check that subimages fit (Bug#14345).
+
 2013-05-09  Stefan Monnier  <address@hidden>
 
        * lread.c (skip_dyn_eof): New function.

=== modified file 'src/image.c'
--- a/src/image.c       2013-04-07 04:41:19 +0000
+++ b/src/image.c       2013-05-12 19:17:04 +0000
@@ -7263,6 +7263,25 @@
       return 0;
     }
 
+  /* Check that the selected subimages fit.  It's not clear whether
+     the GIF spec requires this, but Emacs can crash if they don't fit.  */
+  for (j = 0; j <= idx; ++j)
+    {
+      struct SavedImage *subimage = gif->SavedImages + j;
+      int subimg_width = subimage->ImageDesc.Width;
+      int subimg_height = subimage->ImageDesc.Height;
+      int subimg_top = subimage->ImageDesc.Top;
+      int subimg_left = subimage->ImageDesc.Left;
+      if (! (0 <= subimg_width && 0 <= subimg_height
+            && 0 <= subimg_top && subimg_top <= height - subimg_height
+            && 0 <= subimg_left && subimg_left <= width - subimg_width))
+       {
+         image_error ("Subimage does not fit in image", Qnil, Qnil);
+         fn_DGifCloseFile (gif);
+         return 0;
+       }
+    }
+
   /* Create the X image and pixmap.  */
   if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg, &img->pixmap))
     {


reply via email to

[Prev in Thread] Current Thread [Next in Thread]