Patch 8.2.5016
Problem:    Access before start of text with a put command.
Solution:   Check the length is more than zero.
Files:      src/register.c, src/testdir/test_put.vim


*** ../vim-8.2.5015/src/register.c      2022-05-21 20:16:51.007567185 +0100
--- src/register.c      2022-05-25 15:13:04.635485861 +0100
***************
*** 2219,2227 ****
            len = STRLEN(y_array[y_size - 1]);
            col = (colnr_T)len - lendiff;
            if (col > 1)
!               curbuf->b_op_end.col = col - 1
!                               - mb_head_off(y_array[y_size - 1],
                                                y_array[y_size - 1] + len - 1);
            else
                curbuf->b_op_end.col = 0;
  
--- 2219,2230 ----
            len = STRLEN(y_array[y_size - 1]);
            col = (colnr_T)len - lendiff;
            if (col > 1)
!           {
!               curbuf->b_op_end.col = col - 1;
!               if (len > 0)
!                   curbuf->b_op_end.col -= mb_head_off(y_array[y_size - 1],
                                                y_array[y_size - 1] + len - 1);
+           }
            else
                curbuf->b_op_end.col = 0;
  
*** ../vim-8.2.5015/src/testdir/test_put.vim    2022-01-01 14:59:39.543684481 
+0000
--- src/testdir/test_put.vim    2022-05-25 15:12:33.743501047 +0100
***************
*** 210,214 ****
--- 210,223 ----
    bwipe!
  endfunc
  
+ " this was putting a mark before the start of a line
+ func Test_put_empty_register()
+   new
+   norm yy
+   norm [Pi00   ggv)s0
+   sil! norm [P
+   bwipe!
+ endfunc
+ 
  
  " vim: shiftwidth=2 sts=2 expandtab
*** ../vim-8.2.5015/src/version.c       2022-05-25 12:42:03.974091744 +0100
--- src/version.c       2022-05-25 15:02:16.903737478 +0100
***************
*** 736,737 ****
--- 736,739 ----
  {   /* Add new patch number below this line */
+ /**/
+     5016,
  /**/

-- 
TALL KNIGHT OF NI: Ni!
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// 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/20220525141715.B90421C1DF6%40moolenaar.net.

Raspunde prin e-mail lui