From owner-freebsd-bugs Thu Jan 17 9:20:29 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 72AF537B43A for ; Thu, 17 Jan 2002 09:20:04 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g0HHK4f29536; Thu, 17 Jan 2002 09:20:04 -0800 (PST) (envelope-from gnats) Date: Thu, 17 Jan 2002 09:20:04 -0800 (PST) Message-Id: <200201171720.g0HHK4f29536@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Sheldon Hearn Subject: Re: bin/26869: vi(1) crashes in viewing a file with long lines Reply-To: Sheldon Hearn Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR bin/26869; it has been noted by GNATS. From: Sheldon Hearn To: "Alexey V. Neyman" Cc: bug-followup@freebsd.org Subject: Re: bin/26869: vi(1) crashes in viewing a file with long lines Date: Thu, 17 Jan 2002 19:21:11 +0200 On Thu, 17 Jan 2002 01:50:02 PST, "Alexey V. Neyman" wrote: > > I cannot reproduce this bug under 4.5-RC. Is this still a problem > > for you with the latest -STABLE? > > Yes, its still a problem. Reproduced on 4.5-RC cvsupped Jan 10, 2002. > It is easily reproduceable using the example in PR, it crashed > everywhere I tried it. There's a fix for a similar problem already in -CURRENT. Please try the following patch. If it works, this is the same bug described in these PRs: 23912 33648 If the patch doesn't work for you, you could also try the patch in PR 12801. Ciao, Sheldon. Index: vs_relative.c =================================================================== RCS file: /home/ncvs/src/contrib/nvi/vi/vs_relative.c,v retrieving revision 1.1.1.1 retrieving revision 1.1.1.2 diff -u -d -r1.1.1.1 -r1.1.1.2 --- vs_relative.c 1 Nov 1996 06:45:33 -0000 1.1.1.1 +++ vs_relative.c 7 Jan 2002 14:26:12 -0000 1.1.1.2 @@ -111,6 +111,15 @@ int ch, leftright, listset; char *p; + /* + * Initialize the screen offset. + */ + scno = 0; + + /* Leading number if O_NUMBER option set. */ + if (O_ISSET(sp, O_NUMBER)) + scno += O_NUMBER_LENGTH; + /* Need the line to go any further. */ if (lp == NULL) { (void)db_get(sp, lno, 0, &lp, &len); @@ -122,7 +131,7 @@ if (lp == NULL) { done: if (diffp != NULL) /* XXX */ *diffp = 0; - return (0); + return scno; } /* Store away the values of the list and leftright edit options. */ @@ -130,15 +139,10 @@ leftright = O_ISSET(sp, O_LEFTRIGHT); /* - * Initialize the pointer into the buffer and screen and current - * offsets. + * Initialize the pointer into the buffer and current offset. */ p = lp; - curoff = scno = 0; - - /* Leading number if O_NUMBER option set. */ - if (O_ISSET(sp, O_NUMBER)) - scno += O_NUMBER_LENGTH; + curoff = 0; /* Macro to return the display length of any signal character. */ #define CHLEN(val) (ch = *(u_char *)p++) == '\t' && \ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message