直接在vim官网上下的vim7.2源码包,编译无报错,直接运行vim也无错,但是在home目录下添加vimrc文件之后,再打开会输出如下错误:buffer overflow detected
代码:
*** buffer overflow detected ***: vim terminated
======= Backtrace: =========
/lib/libc.so.6(__fortify_fail+0x37)[0x7ffd4e4675f7]
/lib/libc.so.6[0x7ffd4e4665a0]
vim[0x43e433]
vim[0x43ef19]
vim[0x43fcb0]
vim[0x4481aa]
vim[0x46602b]
vim[0x4644f1]
vim[0x4588c1]
vim[0x5672a8]
vim[0x553bb9]
vim[0x5673d9]
vim[0x49f498]
/lib/libc.so.6(__libc_start_main+0xfd)[0x7ffd4e38eabd]
vim[0x40e9d9]
======= Memory map: ========
00400000-005d7000 r-xp 00000000 08:05 77232 /usr/local/bin/vim
007d6000-007d7000 r--p 001d6000 08:05 77232 /usr/local/bin/vim
007d7000-007ea000 rw-p 001d7000 08:05 77232 /usr/local/bin/vim
007ea000-007f5000 rw-p 00000000 00:00 0
0210f000-02225000 rw-p 00000000 00:00 0 [heap]
7ffd48298000-7ffd482ae000 r-xp 00000000 08:01 2220 /lib/libgcc_s.so.1
7ffd482ae000-7ffd484ad000 ---p 00016000 08:01 2220 /lib/libgcc_s.so.1
7ffd484ad000-7ffd484ae000 r--p 00015000 08:01 2220 /lib/libgcc_s.so.1
7ffd484ae000-7ffd484af000 rw-p 00016000 08:01 2220 /lib/libgcc_s.so.1
7ffd484af000-7ffd484d2000 r-xp 00000000 08:05 6753 /usr/lib/gtk-2.0/2.10.0/engines/libmurrine.so
7ffd484d2000-7ffd486d1000 ---p 00023000 08:05 6753 /usr/lib/gtk-2.0/2.10.0/engines/libmurrine.so
7ffd486d1000-7ffd486d2000 r--p 00022000 08:05 6753 /usr/lib/gtk-2.0/2.10.0/engines/libmurrine.so
7ffd486d2000-7ffd486d3000 rw-p 00023000 08:05 6753 /usr/lib/gtk-2.0/2.10.0/engines/libmurrine.so
7ffd486d3000-7ffd486db000 r-xp 00000000 08:05 3267 /usr/lib/libltdl.so.7.2.0
7ffd486db000-7ffd488db000 ---p 00008000 08:05 3267 /usr/lib/libltdl.so.7.2.0
7ffd488db000-7ffd488dc000 r--p 00008000 08:05 3267 /usr/lib/libltdl.so.7.2.0
7ffd488dc000-7ffd488dd000 rw-p 00009000 08:05 3267 /usr/lib/libltdl.so.7.2.0
7ffd488dd000-7ffd488ea000 r-xp 00000000 08:05 3548 /usr/lib/libtdb.so.1.1.5
7ffd488ea000-7ffd48ae9000 ---p 0000d000 08:05 3548 /usr/lib/libtdb.so.1.1.5
7ffd48ae9000-7ffd48aea000 r--p 0000c000 08:05 3548 /usr/lib/libtdb.so.1.1.5
7ffd48aea000-7ffd48aeb000 rw-p 0000d000 08:05 3548 /usr/lib/libtdb.so.1.1.5
7ffd48aeb000-7ffd48af0000 r-xp 00000000 08:05 3354 /usr/lib/libogg.so.0.6.0
7ffd48af0000-7ffd48cef000 ---p 00005000 08:05 3354 /usr/lib/libogg.so.0.6.0
7ffd48cef000-7ffd48cf0000 r--p 00004000 08:05 3354 /usr/lib/libogg.so.0.6.0
7ffd48cf0000-7ffd48cf1000 rw-p 00005000 08:05 3354 /usr/lib/libogg.so.0.6.0
7ffd48cf1000-7ffd48d10000 r-xp 00000000 08:05 3594 /usr/lib/libvorbis.so.0.4.0
7ffd48d10000-7ffd48f0f000 ---p 0001f000 08:05 3594 /usr/lib/libvorbis.so.0.4.0
7ffd48f0f000-7ffd48f10000 r--p 0001e000 08:05 3594 /usr/lib/libvorbis.so.0.4.0
7ffd48f10000-7ffd48f1e000 rw-p 0001f000 08:05 3594 /usr/lib/libvorbis.so.0.4.0
7ffd48f1e000-7ffd48f25000 r-xp 00000000 08:05 3598 /usr/lib/libvorbisfile.so.3.2.0
7ffd48f25000-7ffd49124000 ---p 00007000 08:05 3598 /usr/lib/libvorbisfile.so.3.2.0
7ffd49124000-7ffd49125000 r--p 00006000 08:05 3598 /usr/lib/libvorbisfile.so.3.2.0
7ffd49125000-7ffd49126000 rw-p 00007000 08:05 3598 /usr/lib/libvorbisfile.so.3.2.0
7ffd49126000-7ffd49135000 r-xp 00000000 08:05 2747 /usr/lib/libcanberra.so.0.1.7
7ffd49135000-7ffd49334000 ---p 0000f000 08:05 2747 /usr/lib/libcanberra.so.0.1.7
7ffd49334000-7ffd49335000 r--p 0000e000 08:05 2747 /usr/lib/libcanberra.so.0.1.7
7ffd49335000-7ffd49336000 rw-p 0000f000 08:05 2747 /usr/lib/libcanberra.so.0.1.7
7ffd49336000-7ffd4933d000 r-xp 00000000 08:01 2288 /lib/librt-2.10.1.so
7ffd4933d000-7ffd4953c000 ---p 00007000 08:01 2288 /lib/librt-2.10.1.so
7ffd4953c000-7ffd4953d000 r--p 00006000 08:01 2288 /lib/librt-2.10.1.so
7ffd4953d000-7ffd4953e000 rw-p 00007000 08:01 2288 /lib/librt-2.10.1.so
7ffd4953e000-7ffd49542000 r-xp 00000000 08:05 3125 /usr/lib/libgthread-2.0.so.0.2200.2
7ffd49542000-7ffd49741000 ---p 00004000 08:05 3125 /usr/lib/libgthread-2.0.so.0.2200.2
7ffd49741000-7ffd49742000 r--p 00003000 08:05 3125 /usr/lib/libgthread-2.0.so.0.2200.2
7ffd49742000-7ffd49743000 rw-p 00004000 08:05 3125 /usr/lib/libgthread-2.0.so.0.2200.2
7ffd49743000-7ffd49746000 r-xp 00000000 08:05 2745 /usr/lib/libcanberra-gtk.so.0.1.1
7ffd49746000-7ffd49946000 ---p 00003000 08:05 2745 /usr/lib/libcanberra-gtk.so.0.1.1
7ffd49946000-7ffd49947000 r--p 00003000 08:05 2745 /usr/lib/libcanberra-gtk.so.0.1.1
7ffd49947000-7ffd49948000 rw-p 00004000 08:05 2745 /usr/lib/libcanberra-gtk.so.0.1.1
7ffd49948000-7ffd4994d000 r-xp 00000000 08:05 6801 /usr/lib/gtk-2.0/modules/libcanberra-gtk-module.so
7ffd4994d000-7ffd49b4c000 ---p 00005000 08:05 6801 /usr/lib/gtk-2.0/modules/libcanberra-gtk-module.so
7ffd49b4c000-7ffd49b4d000 r--p 00004000 08:05 6801 /usr/lib/gtk-2.0/modules/libcanberra-gtk-module.so
7ffd49b4d000-7ffd49b4e000 rw-p 00005000 08:05 6801 /usr/lib/gtk-2.0/modules/libcanberra-gtk-module.so
7ffd49b4e000-7ffd49b71000 r--p 00000000 08:05 55938 /usr/share/locale-langpack/zh_CN/LC_MESSAGES/gtk20-properties.mo
7ffd49b71000-7ffd49b7d000 r-xp 00000000 08:01 2249 /lib/libnss_files-2.10.1.so
7ffd49b7d000-7ffd49d7c000 ---p 0000c000 08:01 2249 /lib/libnss_files-2.10.1.so
7ffd49d7c000-7ffd49d7d000 r--p 0000b000 08:01 2249 /lib/libnss_files-2.10.1.so
7ffd49d7d000-7ffd49d7e000 rw-p 0000c000 08:01 2249 /lib/libnss_files-2.10.1.so
7ffd49d7e000-7ffd49d88000 r-xp 00000000 08:01 2259 /lib/libnss_nis-2.10.1.so
7ffd49d88000-7ffd49f87000 ---p 0000a000 08:01 2259 /lib/libnss_nis-2.10.1.so|49;0MVim: 拦截到致命信号(deadly signal) ABRT
Vim: 结束。
搜索了许多资料,发现了解决方法:
Make的时候加上如下参数:
make CFLAGS="-O2 -D_FORTIFY_SOURCE=1"
如果还不行,就试试这样做:
make CFLAGS="-O3 -D_FORTIFY_SOURCE=1"