Date: Thu, 17 Jan 2002 09:20:04 -0800 (PST) From: Sheldon Hearn <sheldonh@starjuice.net> To: freebsd-bugs@FreeBSD.org Subject: Re: bin/26869: vi(1) crashes in viewing a file with long lines Message-ID: <200201171720.g0HHK4f29536@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/26869; it has been noted by GNATS.
From: Sheldon Hearn <sheldonh@starjuice.net>
To: "Alexey V. Neyman" <alex.neyman@auriga.ru>
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200201171720.g0HHK4f29536>
