all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Lawrence Mitchell <wence@gmx.li>
To: bug-gnu-emacs@gnu.org
Subject: bug#6378: all-completions Segfault
Date: Tue, 08 Jun 2010 17:37:47 +0100	[thread overview]
Message-ID: <pvhpbpblzdic.fsf@gmx.li> (raw)
In-Reply-To: <AANLkTimXG8KLpCE8oINzI4btpgGQOc38SLAsHHY266XO@mail.gmail.com>

Nathan Weizenbaum wrote:
> This segfaults me on GNU Emacs 24.0.50.1 (i686-pc-linux-gnu, GTK+ Version
> 2.16.1) of 2010-05-09:

>   (all-completions "" [])

> I think the problem is on line 1593 of src/minibuf.c, but my
> Emacs-innards-fu isn't good enough to attempt a fix.

I think this patch should fix things

diff --git a/src/minibuf.c b/src/minibuf.c
index ad81bfd..1d93901 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -1590,7 +1590,7 @@ with a space are ignored unless STRING itself starts with a space.  */)
   if (type == 2)
     {
       obsize = XVECTOR (collection)->size;
-      bucket = XVECTOR (collection)->contents[index];
+      bucket = obsize == 0 ? zero : XVECTOR (collection)->contents[index];
     }
 
   while (1)


Although I don't understand why the code-path for the vector
version can't be simplified as in the following patch, which also
fixes the problem AFAICT:

diff --git a/src/minibuf.c b/src/minibuf.c
index ad81bfd..c6aae27 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -1610,22 +1610,14 @@ with a space are ignored unless STRING itself starts with a space.  */)
 	}
       else if (type == 2)
 	{
-	  if (!EQ (bucket, zero))
-	    {
-	      elt = bucket;
-	      eltstring = elt;
-	      if (XSYMBOL (bucket)->next)
-		XSETSYMBOL (bucket, XSYMBOL (bucket)->next);
-	      else
-		XSETFASTINT (bucket, 0);
-	    }
-	  else if (++index >= obsize)
-	    break;
-	  else
-	    {
-	      bucket = XVECTOR (collection)->contents[index];
-	      continue;
-	    }
+          if ( index < obsize )
+            {
+              elt = bucket;
+              eltstring = elt;
+              bucket = XVECTOR (collection)->contents[++index];
+            }
+          else
+            break;
 	}
       else /* if (type == 3) */
 	{

Cheers,
Lawrence
-- 
Lawrence Mitchell <wence@gmx.li>






  reply	other threads:[~2010-06-08 16:37 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-08 15:46 bug#6378: all-completions Segfault Nathan Weizenbaum
2010-06-08 16:37 ` Lawrence Mitchell [this message]
2010-06-08 20:30   ` Stefan Monnier
2010-06-09  5:13     ` Thierry Volpiatto
2010-06-09  6:13       ` Lennart Borgman
2010-06-09  7:23         ` Thierry Volpiatto
2010-06-09  8:51           ` Lennart Borgman
2010-06-09 10:05             ` Thierry Volpiatto
2010-06-09 11:43               ` Andreas Schwab
2010-06-09 12:01                 ` Thierry Volpiatto
2010-06-09 12:13                   ` Andreas Schwab
2010-06-09  6:18       ` Thierry Volpiatto
2010-06-09  9:09     ` Lawrence Mitchell
2010-06-08 16:41 ` Juanma Barranquero
2010-06-08 16:53   ` Juanma Barranquero
2010-06-08 18:58     ` Lennart Borgman
2010-06-08 19:08       ` Juanma Barranquero
2010-06-08 19:32         ` Lennart Borgman
2010-06-08 19:57           ` Juanma Barranquero

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=pvhpbpblzdic.fsf@gmx.li \
    --to=wence@gmx.li \
    --cc=bug-gnu-emacs@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 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.