NetBSD Problem Report #39375
From www@NetBSD.org Mon Aug 18 10:46:35 2008
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
by narn.NetBSD.org (Postfix) with ESMTP id 4F48763B877
for <gnats-bugs@gnats.netbsd.org>; Mon, 18 Aug 2008 10:46:35 +0000 (UTC)
Message-Id: <20080818104634.E921A63B853@narn.NetBSD.org>
Date: Mon, 18 Aug 2008 10:46:34 +0000 (UTC)
From: pilyavets@gmail.com
Reply-To: pilyavets@gmail.com
To: gnats-bugs@NetBSD.org
Subject: seems to integer overflow in vim
X-Send-Pr-Version: www-1.0
>Number: 39375
>Category: pkg
>Synopsis: seems to integer overflow in vim
>Confidential: no
>Severity: critical
>Priority: high
>Responsible: martti
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Aug 18 10:50:00 +0000 2008
>Closed-Date: Wed Mar 10 14:06:49 +0000 2010
>Last-Modified: Sat Mar 13 12:55:01 +0000 2010
>Originator: Oleg Pilyavets
>Release: 4.99.71
>Organization:
Lebedev Physical Institute
>Environment:
NetBSD user 4.99.71 NetBSD 4.99.71 (GENERIC) #0: Fri Aug 1 04:23:17 PDT 2008 builds@wb25:/home/builds/ab/HEAD/i386/200808010002Z-obj/home/builds/ab/HEAD/src/sys/arch/i386/compile/GENERIC i386
>Description:
Simple operations with text using vim often bring him to state "out of memory" or others internal errors. vim is the latest one, installed form precompiled packages (vim-7.1.315), the same result can be obtained for package installed from pkgsrc system. Probably, this can be redefined up to an abitrary code execution if you ask sombody to edit specific file.
$ vim --version
VIM - Vi IMproved 7.1 (2007 May 12, compiled Jun 24 2008 17:39:11)
Included patches: 1-315
Modified by martti@NetBSD.org
Compiled by bouyer@twist.lip6.fr
Normal version without GUI. Features included (+) or not (-):
-arabic +autocmd -balloon_eval -browse -builtin_terms +byte_offset +cindent
-clientserver -clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments
+cryptv -cscope +cursorshape +dialog_con +diff +digraphs -dnd -ebcdic
-emacs_tags +eval +ex_extra +extra_search -farsi +file_in_path +find_in_path
+folding -footer +fork() +gettext -hangul_input +iconv +insert_expand +jumplist
-keymap -langmap +libcall +linebreak +lispindent +listcmds +localmap +menu
+mksession +modify_fname +mouse -mouseshape -mouse_dec -mouse_gpm
-mouse_jsbterm -mouse_netterm +mouse_xterm +multi_byte +multi_lang -mzscheme
-netbeans_intg -osfiletype +path_extra -perl +postscript +printer -profile
-python +quickfix +reltime -rightleft -ruby +scrollbind -signs +smartindent
-sniff +statusline -sun_workshop +syntax +tag_binary +tag_old_static
-tag_any_white -tcl -terminfo +termresponse +textobjects +title -toolbar
+user_commands +vertsplit +virtualedit +visual +visualextra +viminfo +vreplace
+wildignore +wildmenu +windows +writebackup -X11 -xfontset -xim -xsmp
-xterm_clipboard -xterm_save
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
user exrc file: "$HOME/.exrc"
fall-back for $VIM: "/usr/pkg/share/vim"
Compilation:
cc -c -I. -Iproto -DHAVE_CONFIG_H -I/usr/include -O2 -I/usr/include
Linking: cc -L/usr/lib -Wl,-R/usr/lib -Wl,-R/usr/pkg/lib -o vim -ltermcap -liconv -lintl
>How-To-Repeat:
To demonstrate the problem you need just a file with only 4 symbols: 4 spaces:
$ cat file | hexdump -Cv
00000000 20 20 20 20 0a | .|
00000005
Set your pointer to 3rd space and type: ctrl+v $ c
This bring vim to an error:
E341: Internal error: lalloc(0, )
cannot yank; delete anyway (y/n)?
Another error can be demonstrated if you set a pointer to the 4th space (last character) and type the same sequence: ctrl+v $ c
This rise an error:
E342: Out of memory! (allocating 4294967295 bytes)
cannot yank; delete anyway (y/n)?
Practically, this error encounter quite often if you mark a block and then try to replace it:
ctrl+v arrow_down arrown_down .... arrow_down $ c
>Fix:
No known fix and even more strange as I was able to reveal this bug only for NetBSD system. Still now it is not clear for me if another BSDs/Linux affected.
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: pkg-manager->martti
Responsible-Changed-By: wiz@NetBSD.org
Responsible-Changed-When: Mon, 18 Aug 2008 11:02:27 +0000
Responsible-Changed-Why:
Over to maintainer.
From: Martti Kuparinen <martti.kuparinen@iki.fi>
To: gnats-bugs@NetBSD.org
Cc: martti@NetBSD.org, pkg-manager@NetBSD.org, pkgsrc-bugs@NetBSD.org,
gnats-admin@NetBSD.org, wiz@NetBSD.org, pilyavets@gmail.com
Subject: Re: pkg/39375 (seems to integer overflow in vim)
Date: Mon, 18 Aug 2008 14:06:34 +0300
First of all, please update to 7.2.0 and try there...
Martti
From: Oleg Pilyavets <pilyavets@gmail.com>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: pkg/39375 (seems to integer overflow in vim)
Date: Mon, 18 Aug 2008 15:58:17 +0400
7.2.0 is also effected. I've just tested it.
For me it more strange, why this is not observed in Linux... but only in NetBSD?
$ vim --version
VIM - Vi IMproved 7.2 (2008 Aug 9, compiled Aug 18 2008 15:14:05)
Modified by martti@NetBSD.org
Compiled by user@user
Normal version without GUI. Features included (+) or not (-):
-arabic +autocmd -balloon_eval -browse -builtin_terms +byte_offset +cindent
-clientserver -clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments
+cryptv -cscope +cursorshape +dialog_con +diff +digraphs -dnd -ebcdic
-emacs_tags +eval +ex_extra +extra_search -farsi +file_in_path +find_in_path
+float +folding -footer +fork() +gettext -hangul_input +iconv +insert_expand
+jumplist -keymap -langmap +libcall +linebreak +lispindent +listcmds +localmap
+menu +mksession +modify_fname +mouse -mouseshape -mouse_dec -mouse_gpm
-mouse_jsbterm -mouse_netterm -mouse_sysmouse +mouse_xterm +multi_byte
+multi_lang -mzscheme -netbeans_intg -osfiletype +path_extra -perl +postscript
+printer -profile -python +quickfix +reltime -rightleft -ruby +scrollbind
-signs +smartindent -sniff +statusline -sun_workshop +syntax +tag_binary
+tag_old_static -tag_any_white -tcl -terminfo +termresponse +textobjects +title
-toolbar +user_commands +vertsplit +virtualedit +visual +visualextra +viminfo
+vreplace +wildignore +wildmenu +windows +writebackup -X11 -xfontset -xim -xsmp
-xterm_clipboard -xterm_save
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
user exrc file: "$HOME/.exrc"
fall-back for $VIM: "/usr/pkg/share/vim"
Compilation:
cc -c -I. -Iproto -DHAVE_CONFIG_H -I/usr/include -O2 -I/usr/include
Linking: cc -L/usr/lib -Wl,-R/usr/lib -Wl,-R/usr/pkg/lib -o vim -lm -ltermcap -liconv -lintl
(this is the default flags from pkgsrc, I didn't change anything)
On Mon, Aug 18, 2008 at 11:02 +0000, wiz@NetBSD.org wrote:
> Synopsis: seems to integer overflow in vim
>
> Responsible-Changed-From-To: pkg-manager->martti
> Responsible-Changed-By: wiz@NetBSD.org
> Responsible-Changed-When: Mon, 18 Aug 2008 11:02:27 +0000
> Responsible-Changed-Why:
> Over to maintainer.
>
>
From: Oleg Pilyavets <pilyavets@gmail.com>
To: martti@NetBSD.org, gnats-admin@netbsd.org, pkgsrc-bugs@netbsd.org
Subject: Re: pkg/39375 (seems to integer overflow in vim)
Date: Mon, 18 Aug 2008 18:13:28 +0400
Dears,
As I can see from replies of other people, my example demonstrate the problem
in NetBSD only.
Can you at least approve the existance of problem?
Can it be due to libc bug?
Yours
Oleg
From: Oleg Pilyavets <pilyavets@gmail.com>
To: martti@NetBSD.org, gnats-admin@netbsd.org, pkgsrc-bugs@netbsd.org
Subject: Re: pkg/39375 (seems to integer overflow in vim)
Date: Mon, 18 Aug 2008 18:51:26 +0400
Dears,
I've just tested it on my old NetBSD 3.0 system.
The same version of vim-7.1.315 doesn't rise any problem for it.
However, for 4.99.71 it does. Looks like error in base system of NetBSD.
Yours.
From: David Holland <dholland-pbugs@netbsd.org>
To: Oleg Pilyavets <pilyavets@gmail.com>
Cc: martti@NetBSD.org, gnats-admin@netbsd.org, pkgsrc-bugs@netbsd.org
Subject: Re: pkg/39375 (seems to integer overflow in vim)
Date: Tue, 19 Aug 2008 01:01:27 +0000
On Mon, Aug 18, 2008 at 06:51:26PM +0400, Oleg Pilyavets wrote:
> I've just tested it on my old NetBSD 3.0 system.
> The same version of vim-7.1.315 doesn't rise any problem for it.
> However, for 4.99.71 it does. Looks like error in base system of NetBSD.
It doesn't happen on 4.0_STABLE either.
--
David A. Holland
dholland@netbsd.org
From: David Holland <dholland-pbugs@netbsd.org>
To: Oleg Pilyavets <pilyavets@gmail.com>
Cc: martti@NetBSD.org, gnats-admin@netbsd.org, pkgsrc-bugs@netbsd.org,
gnats-bugs@netbsd.org
Subject: Re: pkg/39375 (seems to integer overflow in vim)
Date: Tue, 19 Aug 2008 01:02:26 +0000
On Tue, Aug 19, 2008 at 01:01:27AM +0000, David Holland wrote:
> On Mon, Aug 18, 2008 at 06:51:26PM +0400, Oleg Pilyavets wrote:
> > I've just tested it on my old NetBSD 3.0 system.
> > The same version of vim-7.1.315 doesn't rise any problem for it.
> > However, for 4.99.71 it does. Looks like error in base system of NetBSD.
>
> It doesn't happen on 4.0_STABLE either.
Oops, none of this went into gnats. Fixing that...
--
David A. Holland
dholland@netbsd.org
From: "Oleg Pilyavets" <pilyavets@gmail.com>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: pkg/39375 (seems to integer overflow in vim)
Date: Tue, 19 Aug 2008 18:18:43 +0400
------=_Part_5046_23082505.1219155523943
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
On 19/08/2008, David Holland <dholland-pbugs@netbsd.org> wrote:
>
> The following reply was made to PR pkg/39375; it has been noted by GNATS.
>
>
> From: David Holland <dholland-pbugs@netbsd.org>
> To: Oleg Pilyavets <pilyavets@gmail.com>
> Cc: martti@NetBSD.org, gnats-admin@netbsd.org, pkgsrc-bugs@netbsd.org,
> gnats-bugs@netbsd.org
>
> Subject: Re: pkg/39375 (seems to integer overflow in vim)
>
> Date: Tue, 19 Aug 2008 01:02:26 +0000
>
>
> On Tue, Aug 19, 2008 at 01:01:27AM +0000, David Holland wrote:
> > On Mon, Aug 18, 2008 at 06:51:26PM +0400, Oleg Pilyavets wrote:
> > > I've just tested it on my old NetBSD 3.0 system.
> > > The same version of vim-7.1.315 doesn't rise any problem for it.
> > > However, for 4.99.71 it does. Looks like error in base system of
> NetBSD.
> >
> > It doesn't happen on 4.0_STABLE either.
>
> Oops, none of this went into gnats. Fixing that...
Ok, test it on current, please.
--
> David A. Holland
> dholland@netbsd.org
>
>
------=_Part_5046_23082505.1219155523943
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
<br><br><div><span class="gmail_quote">On 19/08/2008, David Holland <<a href="mailto:dholland-pbugs@netbsd.org">dholland-pbugs@netbsd.org</a>> wrote:</span><blockquote class="gmail_quote" style="margin-top: 0; margin-right: 0; margin-bottom: 0; margin-left: 0; margin-left: 0.80ex; border-left-color: #cccccc; border-left-width: 1px; border-left-style: solid; padding-left: 1ex">
The following reply was made to PR pkg/39375; it has been noted by GNATS.<br><br><br>From: David Holland <<a href="mailto:dholland-pbugs@netbsd.org">dholland-pbugs@netbsd.org</a>><br> To: Oleg Pilyavets <<a href="mailto:pilyavets@gmail.com">pilyavets@gmail.com</a>><br>
Cc: martti@NetBSD.org, <a href="mailto:gnats-admin@netbsd.org">gnats-admin@netbsd.org</a>, <a href="mailto:pkgsrc-bugs@netbsd.org">pkgsrc-bugs@netbsd.org</a>,<br> <a href="mailto:gnats-bugs@netbsd.org">gnats-bugs@netbsd.org</a><br>
<br>Subject: Re: pkg/39375 (seems to integer overflow in vim)<br><br>Date: Tue, 19 Aug 2008 01:02:26 +0000<br><br><br> On Tue, Aug 19, 2008 at 01:01:27AM +0000, David Holland wrote:<br> > On Mon, Aug 18, 2008 at 06:51:26PM +0400, Oleg Pilyavets wrote:<br>
> > I've just tested it on my old NetBSD 3.0 system.<br> > > The same version of vim-7.1.315 doesn't rise any problem for it.<br> > > However, for 4.99.71 it does. Looks like error in base system of NetBSD.<br>
><br> > It doesn't happen on 4.0_STABLE either.<br><br> Oops, none of this went into gnats. Fixing that...</blockquote><div><br>Ok, test it on current, please. </div><br><blockquote class="gmail_quote" style="margin-top: 0; margin-right: 0; margin-bottom: 0; margin-left: 0; margin-left: 0.80ex; border-left-color: #cccccc; border-left-width: 1px; border-left-style: solid; padding-left: 1ex">
--<br> David A. Holland<br> <a href="mailto:dholland@netbsd.org">dholland@netbsd.org</a><br><br></blockquote></div><br>
------=_Part_5046_23082505.1219155523943--
From: "Oleg Pilyavets" <pilyavets@gmail.com>
To: gnats-bugs@netbsd.org
Cc: martti@netbsd.org, gnats-admin@netbsd.org, pkgsrc-bugs@netbsd.org
Subject: Re: pkg/39375 (seems to integer overflow in vim)
Date: Tue, 19 Aug 2008 18:24:26 +0400
------=_Part_5096_28463486.1219155866111
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Ok. test it on current, please.
On 19/08/2008, David Holland <dholland-pbugs@netbsd.org> wrote:
>
> The following reply was made to PR pkg/39375; it has been noted by GNATS.
>
>
> From: David Holland <dholland-pbugs@netbsd.org>
> To: Oleg Pilyavets <pilyavets@gmail.com>
> Cc: martti@NetBSD.org, gnats-admin@netbsd.org, pkgsrc-bugs@netbsd.org,
> gnats-bugs@netbsd.org
>
> Subject: Re: pkg/39375 (seems to integer overflow in vim)
>
> Date: Tue, 19 Aug 2008 01:02:26 +0000
>
>
> On Tue, Aug 19, 2008 at 01:01:27AM +0000, David Holland wrote:
> > On Mon, Aug 18, 2008 at 06:51:26PM +0400, Oleg Pilyavets wrote:
> > > I've just tested it on my old NetBSD 3.0 system.
> > > The same version of vim-7.1.315 doesn't rise any problem for it.
> > > However, for 4.99.71 it does. Looks like error in base system of
> NetBSD.
> >
> > It doesn't happen on 4.0_STABLE either.
>
> Oops, none of this went into gnats. Fixing that...
>
> --
> David A. Holland
> dholland@netbsd.org
>
>
------=_Part_5096_28463486.1219155866111
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
<br>Ok. test it on current, please.<br><br><div><span class="gmail_quote">On 19/08/2008, David Holland <<a href="mailto:dholland-pbugs@netbsd.org">dholland-pbugs@netbsd.org</a>> wrote:</span><blockquote class="gmail_quote" style="margin-top: 0; margin-right: 0; margin-bottom: 0; margin-left: 0; margin-left: 0.80ex; border-left-color: #cccccc; border-left-width: 1px; border-left-style: solid; padding-left: 1ex">
The following reply was made to PR pkg/39375; it has been noted by GNATS.<br><br><br>From: David Holland <<a href="mailto:dholland-pbugs@netbsd.org">dholland-pbugs@netbsd.org</a>><br> To: Oleg Pilyavets <<a href="mailto:pilyavets@gmail.com">pilyavets@gmail.com</a>><br>
Cc: martti@NetBSD.org, <a href="mailto:gnats-admin@netbsd.org">gnats-admin@netbsd.org</a>, <a href="mailto:pkgsrc-bugs@netbsd.org">pkgsrc-bugs@netbsd.org</a>,<br> <a href="mailto:gnats-bugs@netbsd.org">gnats-bugs@netbsd.org</a><br>
<br>Subject: Re: pkg/39375 (seems to integer overflow in vim)<br><br>Date: Tue, 19 Aug 2008 01:02:26 +0000<br><br><br> On Tue, Aug 19, 2008 at 01:01:27AM +0000, David Holland wrote:<br> > On Mon, Aug 18, 2008 at 06:51:26PM +0400, Oleg Pilyavets wrote:<br>
> > I've just tested it on my old NetBSD 3.0 system.<br> > > The same version of vim-7.1.315 doesn't rise any problem for it.<br> > > However, for 4.99.71 it does. Looks like error in base system of NetBSD.<br>
><br> > It doesn't happen on 4.0_STABLE either.<br><br> Oops, none of this went into gnats. Fixing that...<br><br> --<br> David A. Holland<br> <a href="mailto:dholland@netbsd.org">dholland@netbsd.org</a><br>
<br></blockquote></div><br>
------=_Part_5096_28463486.1219155866111--
From: Oleg Pilyavets <pilyavets@gmail.com>
To: dholland-pbugs@netbsd.org
Cc: martti@netbsd.org, gnats-admin@netbsd.org, pkgsrc-bugs@netbsd.org,
gnats-bugs@netbsd.org
Subject: Re: pkg/39375 (seems to integer overflow in vim)
Date: Tue, 19 Aug 2008 18:51:14 +0400
Test it on NetBSD current, please.
From: Martti Kuparinen <martti@NetBSD.org>
To: Oleg Pilyavets <pilyavets@gmail.com>
Cc: dholland-pbugs@netbsd.org, gnats-admin@netbsd.org,
pkgsrc-bugs@netbsd.org, gnats-bugs@netbsd.org
Subject: Re: pkg/39375 (seems to integer overflow in vim)
Date: Tue, 19 Aug 2008 21:29:22 +0300
Here's my test:
# uname -srm
NetBSD 4.99.72 amd64
# pkg_info | grep vim
vim-share-7.2.0 Data files for the vim editor (vi clone)
vim-7.2.0 Vim editor (vi clone) without GUI
# cat file | hexdump -Cv
00000000 20 20 20 20 0a | .|
00000005
# vim file
Now, on 3rd space if I type ctrl+v $ c everything just work, no
error or anything weird. Same thing with the last character,
everything works fine.
Could this be an i386 issues as things work on my amd64?
State-Changed-From-To: open->closed
State-Changed-By: martti@NetBSD.org
State-Changed-When: Wed, 10 Mar 2010 14:06:49 +0000
State-Changed-Why:
Fixed in vim 7.2.391
From: Oleg Pilyavets <pilyavets@gmail.com>
To: gnats-bugs@netbsd.org
Cc: martti@netbsd.org, pkgsrc-bugs@netbsd.org, gnats-admin@netbsd.org
Subject: Re: pkg/39375 (seems to integer overflow in vim)
Date: Sat, 13 Mar 2010 10:55:38 +0100
It was incredibile fast, Martti: to spend 19 months to resovle the
problem easily reproducible. Can you explain now why the tests you did
at that time failed to discover this "Internal alloc(0) error when
doing CTRL-V $ c"?
On 10 March 2010 15:06, <martti@netbsd.org> wrote:
Synopsis: seems to integer overflow in vim
State-Changed-From-To: open->closed
State-Changed-By: martti@NetBSD.org
State-Changed-When: Wed, 10 Mar 2010 14:06:49 +0000
State-Changed-Why:
Fixed in vim 7.2.391
On 10/03/2010, martti@netbsd.org <martti@netbsd.org> wrote:
> Synopsis: seems to integer overflow in vim
>
> State-Changed-From-To: open->closed
> State-Changed-By: martti@NetBSD.org
> State-Changed-When: Wed, 10 Mar 2010 14:06:49 +0000
> State-Changed-Why:
> Fixed in vim 7.2.391
>
>
>
>
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.