all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Stephen Berman <stephen.berman@gmx.net>
Cc: 17771@debbugs.gnu.org
Subject: bug#17771: 24.3.91; SIGSEGV in cleanup_vector
Date: Fri, 13 Jun 2014 16:58:32 +0300	[thread overview]
Message-ID: <83lht0x65z.fsf@gnu.org> (raw)
In-Reply-To: <87ha3o7w68.fsf@rosalinde.fritz.box>

> From: Stephen Berman <stephen.berman@gmx.net>
> Cc: 17771@debbugs.gnu.org
> Date: Fri, 13 Jun 2014 15:53:35 +0200
> 
> On Fri, 13 Jun 2014 16:44:39 +0300 Eli Zaretskii <eliz@gnu.org> wrote:
> 
> >> From: Stephen Berman <stephen.berman@gmx.net>
> >> Cc: 17771@debbugs.gnu.org
> >> Date: Fri, 13 Jun 2014 15:34:12 +0200
> >> 
> >> On Fri, 13 Jun 2014 16:28:54 +0300 Eli Zaretskii <eliz@gnu.org> wrote:
> >> 
> >> >> From: Stephen Berman <stephen.berman@gmx.net>
> >> >> Cc: 17771@debbugs.gnu.org
> >> >> Date: Fri, 13 Jun 2014 14:39:42 +0200
> >> >> 
> >> >> Program received signal SIGSEGV, Segmentation fault.
> >> >> 0x00000000005aa564 in cleanup_vector (vector=0x413c318)
> >> >>     at ../../../../bzr/emacs/emacs-24/src/alloc.c:2929
> >> >> 2929          ((struct font *) vector)->driver->close ((struct font *) vector);
> >> >> (gdb) p vector
> >> >> $1 = (struct Lisp_Vector *) 0x413c318
> >> >> (gdb) p vector->driver
> >> >> There is no member named driver.
> >> >> (gdb) p vector->driver->close
> >> >> There is no member named driver.
> >> >
> >> >  (gdb) p ((struct font *) vector)->driver
> >> >  (gdb) p ((struct font *) vector)->driver->close
> >> 
> >> (gdb) p ((struct font *) vector)->driver
> >> $4 = (struct font_driver *) 0x0
> >> (gdb) p ((struct font *) vector)->driver->close
> >> Cannot access memory at address 0x40
> >
> > IOW, the font driver is NULL.
> 
> Could that be due to my typing `C-g'?

It evidently is.  My current theory is that the font driver was not
fully set up, before Emacs got interrupted by C-g.

> If I don't do that, the file does get displayed.  But `C-g'
> shouldn't make Emacs crash.  Do you see what the problem is, or can
> I provide further information?

The immediate problem is clearly that we dereference a NULL pointer.

I installed a trivial workaround for that in r117235 on the emacs-24
branch.  The diffs are below.  Can you try this and see if the problem
is solved?  It's possible that the real problem is somewhere else, in
which case you will probably see it when you apply the patch.

Thanks.

=== modified file 'src/alloc.c'
--- src/alloc.c	2014-05-30 20:19:29 +0000
+++ src/alloc.c	2014-06-13 13:53:24 +0000
@@ -2924,9 +2924,16 @@ cleanup_vector (struct Lisp_Vector *vect
       && ((vector->header.size & PSEUDOVECTOR_SIZE_MASK)
 	  == FONT_OBJECT_MAX))
     {
-      /* Attempt to catch subtle bugs like Bug#16140.  */
-      eassert (valid_font_driver (((struct font *) vector)->driver));
-      ((struct font *) vector)->driver->close ((struct font *) vector);
+      struct font_driver *drv = ((struct font *) vector)->driver;
+
+      /* The font driver might sometimes be NULL, e.g. if Emacs was
+	 interrupted before it had time to set it up.  */
+      if (drv)
+	{
+	  /* Attempt to catch subtle bugs like Bug#16140.  */
+	  eassert (valid_font_driver (drv));
+	  drv->close ((struct font *) vector);
+	}
     }
 }
 






  reply	other threads:[~2014-06-13 13:58 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-13  9:12 bug#17771: 24.3.91; SIGSEGV in cleanup_vector Stephen Berman
2014-06-13  9:41 ` Eli Zaretskii
2014-06-13  9:50   ` Stephen Berman
2014-06-13 12:19     ` Eli Zaretskii
2014-06-13 12:39       ` Stephen Berman
2014-06-13 13:28         ` Eli Zaretskii
2014-06-13 13:34           ` Stephen Berman
2014-06-13 13:44             ` Eli Zaretskii
2014-06-13 13:53               ` Stephen Berman
2014-06-13 13:58                 ` Eli Zaretskii [this message]
2014-06-13 14:13                   ` Stephen Berman
2014-06-13 14:52                     ` Eli Zaretskii
2014-06-16  8:02                       ` Dmitry Antipov
2014-06-16 10:16                         ` Stephen Berman
2014-06-16 12:37                           ` Dmitry Antipov
2014-06-16 13:07                             ` Stephen Berman
2014-06-16 13:19                               ` Dmitry Antipov
2014-06-16 13:32                                 ` Andreas Schwab
2014-06-16 15:49                                   ` Stephen Berman
2014-06-16 16:21                                     ` Dmitry Antipov
2014-06-16 21:34                                       ` Stephen Berman
2014-06-17  2:25                                         ` Dmitry Antipov
2014-06-17 13:40                                           ` Stephen Berman
2014-06-18 12:54                                   ` Wolfgang Jenkner
2014-06-18 13:50                                     ` Stephen Berman
2014-06-18 14:01                                       ` Dmitry Antipov
2014-06-18 16:00                                         ` Stephen Berman
2014-06-18 16:24                                           ` Dmitry Antipov
2014-06-18 17:00                                             ` Stephen Berman
2014-08-12  3:59                                               ` Glenn Morris
2014-06-16 15:49                                 ` Stephen Berman
2014-06-16 16:03                                   ` Dmitry Antipov
2014-06-16 21:33                                     ` Stephen Berman
2014-06-17  2:09                                       ` Dmitry Antipov
2014-06-17 13:41                                         ` Stephen Berman
2014-06-17 18:11                                           ` Dmitry Antipov
2014-06-18 13:50                                             ` Stephen Berman

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

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

  git send-email \
    --in-reply-to=83lht0x65z.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=17771@debbugs.gnu.org \
    --cc=stephen.berman@gmx.net \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.