Patch 8.2.4647
Problem:    "source" can read past end of copied line.
Solution:   Add a terminating NUL.
Files:      src/scriptfile.c, src/testdir/test_source.vim


*** ../vim-8.2.4646/src/scriptfile.c    2022-03-24 11:22:07.215294108 +0000
--- src/scriptfile.c    2022-03-29 19:51:02.259704070 +0100
***************
*** 1918,1924 ****
--- 1918,1927 ----
                break;              // all the lines are processed
            ga_concat(&ga, ((char_u **)sp->buflines.ga_data)[sp->buf_lnum]);
            sp->buf_lnum++;
+           if (ga_grow(&ga, 1) == FAIL)
+               break;
            buf = (char_u *)ga.ga_data;
+           buf[ga.ga_len++] = NUL;
        }
        else
        {
*** ../vim-8.2.4646/src/testdir/test_source.vim 2022-03-27 13:36:47.110991835 
+0100
--- src/testdir/test_source.vim 2022-03-29 19:49:31.779777560 +0100
***************
*** 646,649 ****
--- 646,658 ----
    %bw!
  endfunc
  
+ func Test_source_buffer_long_line()
+   " This was reading past the end of the line.
+   new
+   norm300gr0
+   so
+   bwipe!
+ endfunc
+ 
+ 
  " vim: shiftwidth=2 sts=2 expandtab
*** ../vim-8.2.4646/src/version.c       2022-03-29 13:24:49.199974887 +0100
--- src/version.c       2022-03-29 19:47:37.391879820 +0100
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     4647,
  /**/

-- 
Proofread carefully to see if you any words out.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20220329185241.4C60C1C0C4D%40moolenaar.net.

Raspunde prin e-mail lui