unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: 14345-done@debbugs.gnu.org
Subject: bug#14345: 24.3; shr-insert-document crashes gtk-emacs
Date: Sun, 12 May 2013 12:21:21 -0700	[thread overview]
Message-ID: <518FEBB1.1060905@cs.ucla.edu> (raw)
In-Reply-To: <87bo8rihxe.fsf@zancas.localnet>

I installed the following patch as trunk bzr 112562 to fix
this.  It works for me, including for Glenn's C-c C-c test.
I'll cross my fingers and mark the bug as fixed.

=== modified file 'src/ChangeLog'
--- src/ChangeLog	2013-05-09 18:30:46 +0000
+++ src/ChangeLog	2013-05-12 19:14:22 +0000
@@ -1,3 +1,7 @@
+2013-05-12  Paul Eggert  <eggert@cs.ucla.edu>
+
+	* image.c (gif_load): Check that subimages fit (Bug#14345).
+
 2013-05-09  Stefan Monnier  <monnier@iro.umontreal.ca>
 
 	* lread.c (skip_dyn_eof): New function.

=== modified file 'src/image.c'
--- src/image.c	2013-04-07 04:41:19 +0000
+++ src/image.c	2013-05-12 19:15:38 +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))
     {






      parent reply	other threads:[~2013-05-12 19:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-04  2:43 bug#14345: 24.3; shr-insert-document crashes gtk-emacs David Bremner
     [not found] ` <handler.14345.B.136763603414892.ack@debbugs.gnu.org>
2013-05-04 11:45   ` bug#14345: backtrace David Bremner
2013-05-08  0:20 ` bug#14345: 24.3; shr-insert-document crashes gtk-emacs Glenn Morris
2013-05-08  1:33   ` Glenn Morris
2013-05-08  1:35     ` Glenn Morris
2013-05-08  1:38       ` Glenn Morris
2013-05-08  1:44         ` Glenn Morris
2013-05-12 19:21 ` Paul Eggert [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=518FEBB1.1060905@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=14345-done@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).