Subject: bin/15474: post NetBSD-1.5 ex/vi segv bug
To: None <gnats-bugs@gnats.netbsd.org>
From: Chuck Cranor <chuck@xxx.research.att.com>
List: netbsd-bugs
Date: 02/03/2002 21:00:54
>Number:         15474
>Category:       bin
>Synopsis:       ex/vi can segv
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Feb 03 18:01:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Chuck Cranor
>Release:        NetBSD 1.5ZA
>Organization:
at&t labs-research
>Environment:
System: NetBSD xxx.research.att.com 1.5ZA NetBSD 1.5ZA (XXX) #0: Mon Jan 28 16:11:12 EST 2002 chuck@test.research.att.com:/usr/netbsd/current/src/sys/arch/i386/compile/XXX i386
Architecture: i386
Machine: i386

	/usr/bin/vi compiled on Jan 16th from a -current source.

>Description:
	ex can be fooled into getting a segv.
>How-To-Repeat:

	% ex
	/tmp/vi.08947b: new file: line 1
	:r/tmp/ok
	Error: /tmp/ok: No such file or directory
	:e/tmp/ok
	:i
	
	.
	Segmentation fault
	% 

>Fix:

	suspect something the ":r" does fools ":e" into not knowing
	that /tmp/ok is a new file.   (does not segv without the :r).

	note that it worked ok in NetBSD/1.5:

	xbsd[2]> ex
	/tmp/vi.29709b: new file: line 1
	:r/tmp/ok
	Error: /tmp/ok: No such file or directory
	:e/tmp/ok
	/tmp/ok: new file: line 1
	:i
	
	.
	:q!
	xbsd[3]> uname -a
	NetBSD xbsd.research.att.com 1.5 NetBSD 1.5 (XXX) #0: Thu Nov 16 14:51:11 EST 2000     chuck@test.research.att.com:/usr/netbsd/current/src/sys/arch/i386/compile/XXX i386
	xbsd[4]> 

>Release-Note:
>Audit-Trail:
>Unformatted: