GNU bug report logs - #43281
27.1; Opening a bad GIF segfaults Emacs

Previous Next

Package: emacs;

Reported by: nnoodle <nnoodle <at> chiru.no>

Date: Tue, 8 Sep 2020 15:55:02 UTC

Severity: normal

Tags: fixed

Found in version 27.1

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #11 received at 43281 <at> debbugs.gnu.org (full text, mbox):

From: Robert Pluim <rpluim <at> gmail.com>
To: nnoodle <nnoodle <at> chiru.no>
Cc: 43281 <at> debbugs.gnu.org
Subject: Re: bug#43281: 27.1; Opening a bad GIF segfaults Emacs
Date: Tue, 08 Sep 2020 19:10:53 +0200
>>>>> On Tue, 8 Sep 2020 20:38:30 +0700, nnoodle <nnoodle <at> chiru.no> said:

    nnoodle> To reproduce:
    nnoodle> $ echo 'GIF89a;' > bad.gif
    nnoodle> $ emacs -Q bad.gif

    nnoodle> The result will be a segmentation fault.

This should fix it, can you test it?

Thanks

Robert

diff --git a/src/image.c b/src/image.c
index d8c34669cc..6e3b71a869 100644
--- a/src/image.c
+++ b/src/image.c
@@ -8251,7 +8251,7 @@ gif_load (struct frame *f, struct image *img)
   Lisp_Object specified_file = image_spec_value (img->spec, QCfile, NULL);
   Lisp_Object specified_data = image_spec_value (img->spec, QCdata, NULL);
   EMACS_INT idx;
-  int gif_err;
+  int gif_err = 0;
 
   if (NILP (specified_data))
     {
@@ -8277,7 +8277,8 @@ gif_load (struct frame *f, struct image *img)
 	{
 #if HAVE_GIFERRORSTRING
 	  image_error ("Cannot open `%s': %s",
-		       file, build_string (GifErrorString (gif_err)));
+		       file, gif_err ? build_string (GifErrorString (gif_err))
+                       : build_string ("Unknown error from gif library"));
 #else
 	  image_error ("Cannot open `%s'", file);
 #endif




This bug report was last modified 4 years and 257 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.