To: "Graham, Scott" <[email protected]>
In-Reply-To: <[email protected]>
Cc: [email protected]
Subject: patch 5.4o.2 (was: vim54n - 'gf' causes IPF)
From: Bram Moolenaar <[email protected]>
Date: Tue, 13 Jul 1999 10:32:45 +0200
Sender: [email protected]


Scott Graham wrote:
> Doing 'gf' on top of file.c in the following line:
>
> file.c://comment here
>
> causes an IPF (it was grep output). It seems to be related to the ':'
> specifically, but I haven't narrowed it down any further.

Indeed.  It is easy to reproduce.

> - output of bugreport.vim follows (sorry it's so large, wasn't sure if you'd
>   want any or all of it):

Didn't need it in this case.  It often helps to find specific info, although
it is indeed a bit large and it can be difficult to find the item that
matters.  If you can reproduce the problem with "vim -u NONE" I mostly don't
need the bugreport.


Patch 5.4o.2
Problem:    Crash when using "gf" on "file.c://comment here". (Scott Graham)
Solution:   Fix wrong use of pointers in get_file_name_in_path().
Files:      src/window.c


*** ../vim-5.4o/src/window.c    Sun Jul 11 20:10:36 1999
--- src/window.c        Tue Jul 13 10:24:22 1999
***************
*** 1852,1857 ****
--- 1852,1858 ----
 {
     char_u  *ptr;
     char_u  *file_name;
+     char_u  *path;
     int           len;

     /*
***************
*** 1894,1908 ****
        * Such a link looks like "type://machine/path". Only "/path" is used.
        * First search for the string "://", then for the extra '/'
        */
!       if ((file_name = vim_strchr(ptr, ':')) != NULL &&
!               ((path_is_url(file_name) == URL_SLASH &&
!                 (file_name = vim_strchr(file_name + 3, '/')) != NULL) ||
!                (path_is_url(file_name) == URL_BACKSLASH &&
!                 (file_name = vim_strchr(file_name + 3, '\\')) != NULL)) &&
!               file_name < ptr + len)
       {
!           len -= file_name - ptr;
!           ptr = file_name;
           if (ptr[1] == '~')      /* skip '/' for /~user/path */
           {
               ++ptr;
--- 1895,1909 ----
        * Such a link looks like "type://machine/path". Only "/path" is used.
        * First search for the string "://", then for the extra '/'
        */
!       if ((file_name = vim_strchr(ptr, ':')) != NULL
!               && ((path_is_url(file_name) == URL_SLASH
!                       && (path = vim_strchr(file_name + 3, '/')) != NULL)
!                   || (path_is_url(file_name) == URL_BACKSLASH
!                       && (path = vim_strchr(file_name + 3, '\\')) != NULL))
!               && path < ptr + len)
       {
!           len -= path - ptr;
!           ptr = path;
           if (ptr[1] == '~')      /* skip '/' for /~user/path */
           {
               ++ptr;

--
hundred-and-one symptoms of being an internet addict:
66. You create a homepage with the impression to cure the afflicted...but
   your hidden agenda is to receive more e-mail.

--/-/---- Bram Moolenaar ---- [email protected] ---- [email protected] ---\-\--
 \ \    www.vim.org/iccf      www.moolenaar.net       www.vim.org    / /