Hi,

I have recently discovered that my vim reliably crashes if I try to do
a particular series of inputs while using the clang_complete. I could
reproduce the problem with the latest hg sources. Using gdb I tracked
the problem down to the fact that compl_leader was NULL in edit.c. The
backtrace was the following:

1:osg_scene.cpp [+][cpp]  [Git(master)][499/586=85%] [17]
No matching autocommands
Program received signal SIGSEGV, Segmentation fault.
0x00000000004ea770 in ins_bytes (p=0x3 <Address 0x3 out of bounds>) at
misc1.c:1887
1887        ins_bytes_len(p, (int)STRLEN(p));
(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)

the following patch fixed the problem:

atom@kamichan ~/make/vim/vim $ hg diff
diff -r d6c709d07173 src/edit.c
--- a/src/edit.c        Fri Sep 02 14:18:20 2011 +0200
+++ b/src/edit.c        Mon Sep 05 17:03:29 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

atom@kamichan ~/make/vim/vim $ hg summary
parent: 3043:d6c709d07173 tip
 Added tag v7-3-293 for changeset 6cd0d6413a2e
branch: default
commit: 1 modified
update: (current)


I hope this isn't just a stupid workaround. I don't know my way around
the vim sourcecode well enough to be sure this is the right way to fix
this. I hope for this fix to be included in a recent update to vim
though.
I also want to thank SIlex and woldrich from the #vim channel on
freenode for all the help in the debugging of this problem.


I also want to thank everybody who has been making this wonderful
editor I have been using for years.

Regards,

Gašper Ažman

-- 
Atoms are watching...

-- 
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