Ron Aaron <[email protected]> wrote: > Compiling with "./configure CFLAGS='-g'" and then gdb src/vim, I get a crash > right at startup do to buffer overflow: > > > #4 0xb7644105 in __GI___fortify_fail (msg=0xb76a3648 "buffer overflow > detected") at fortify_fail.c:38 > #5 0xb7642eba in __GI___chk_fail () at chk_fail.c:29 > #6 0xb76421ed in __strcpy_chk (dest=dest@entry=0x82eb671 <vimvars+17> "c", > src=0x81edf5d "count", destlen=<optimized out>, destlen@entry=1) > at strcpy_chk.c:61 > #7 0x0807920a in strcpy (__src=<optimized out>, __dest=0x82eb671 > <vimvars+17> "c") at /usr/include/i386-linux-gnu/bits/string3.h:105 > #8 eval_init () at eval.c:851 > #9 0x081ade34 in main (argc=1, argv=0xbffff754) at main.c:231 > > Rerunning w/ a breakpoint at the problem: > > 851 STRCPY(p->vv_di.di_key, p->vv_name); > (gdb) p p->vv_di > $1 = {di_tv = {v_type = 1 '\001', v_lock = 0 '\000', vval = {v_number = 0, > v_float = 0, v_string = 0x0, v_list = 0x0, v_dict = 0x0}}, > di_flags = 0 '\000', di_key = ""} > (gdb) p p->vv_di.di_key > $2 = "" > (gdb) p p->vv_name > $3 = 0x81edf5d "count" > (gdb) n > *** buffer overflow detected ***: /home/ron/proj/2html-test/vim/src/vim > terminated
You need to compile with -D_FORTIFY_SOURCE=1. Normally the configure script takes care of that, unless you tweak the Makefile manually. gcc on Ubuntu enables -D_FORTIFY_SOURCE=2 if you don't specify anything which is known to break Vim. === BEGIN quite of "man gcc" on Ubuntu === NOTE: In Ubuntu 8.10 and later versions, -D_FORTIFY_SOURCE=2 is set by default, and is activated when -O is set to 2 or higher. This enables additional compile-time and run-time checks for several libc functions. To disable, specify either -U_FORTIFY_SOURCE or -D_FORTIFY_SOURCE=0. === END quote === -D_FORTIFY_SOURCE=2 is dangerous as it can break correct programs. -D_FORTIFY_SOURCE=1 should only cause a crash in case of a real bug in Vim. See http://gcc.gnu.org/ml/gcc-patches/2004-09/msg02055.html === BEGIN quote === The intended use in glibc is that by default no protection is done, when the above GCC 4.0+ and -D_FORTIFY_SOURCE=1 is used at optimization level 1 and above, security measures that shouldn't change behaviour of conforming programs are taken. With -D_FORTIFY_SOURCE=2 some more checking is added, but some conforming programs might fail. === END quote === Dominique -- -- 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 --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
