(Note: I can't post to this list yet, a mod has to approve this email.
I'm also sorry for the gmail chat invites gmail spammed in my name, an
unlucky misclick caused that and I didn't know how to stop it. I also
sent this patch yesterday already, but it seems every one of the mods
failed to post it to the list, so I'm sending it again in hope of it
getting through this time.)

Hi everyone,

I also stumbled upon a segfault on autocompletion. I proceeded to find
a bug in the latest hg source in edit.c that I think causes the crash
- code forgets to check whether the leader pointer is null.

This is what fixes the issue for me:

####################################
diff -r d6c709d07173 src/edit.c
--- a/src/edit.c        Fri Sep 02 14:18:20 2011 +0200
+++ b/src/edit.c        Tue Sep 06 15:22:02 2011 +0200
@@ -4604,7 +4604,7 @@
     {
        if (!compl_get_longest || compl_used_match)
            ins_compl_insert();
-       else
+       else if(compl_leader != NULL)
            ins_bytes(compl_leader + ins_compl_len());
     }
     else
####################################

The relevant backtrace is
####################################
(gdb)
bt
#0  0x00000000004ea770 in ins_bytes (p=0x3 <Address 0x3 out of
bounds>) at misc1.c:
1887
#1  0x000000000044ba1f in ins_compl_next (allow_get_expansion=1,
count=1, insert_match=1) at edit.c:
4608
#2  0x000000000044cda6 in ins_complete (c=14) at edit.c:
5208
#3  0x00000000004494c2 in ins_compl_new_leader () at edit.c:
3402
#4  0x000000000044960d in ins_compl_addleader (c=118) at edit.c:
3462
#5  0x0000000000445425 in edit (cmdchar=65, startln=0, count=1) at
edit.c:
782
#6  0x0000000000517e23 in invoke_edit (cap=0x7fffffffe060, repl=0,
cmd=65, startln=0) at normal.c:
9070
#7  0x0000000000517dbc in nv_edit (cap=0x7fffffffe060) at normal.c:
9043
#8  0x000000000050a3c8 in normal_cmd (oap=0x7fffffffe120, toplevel=1)
at normal.c:
1193
#9  0x00000000005ece62 in main_loop (cmdwin=0, noexmode=0) at main.c:
1262
#10 0x00000000005ec93c in main (argc=1, argv=0x7fffffffe428) at main.c:
964
(gdb)
####################################

-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Raspunde prin e-mail lui