Patch 9.0.1429
Problem:    Invalid memory access when ending insert mode.
Solution:   Check if the insert_skip value is valid.
Files:      src/edit.c


*** ../vim-9.0.1428/src/edit.c  2023-03-25 20:06:10.500816586 +0000
--- src/edit.c  2023-03-26 21:26:06.626831697 +0100
***************
*** 2438,2449 ****
       * otherwise CTRL-O w and then <Left> will clear "last_insert".
       */
      ptr = get_inserted();
!     if (did_restart_edit == 0 || (ptr != NULL
!                                      && (int)STRLEN(ptr) > new_insert_skip))
      {
        vim_free(last_insert);
        last_insert = ptr;
!       last_insert_skip = new_insert_skip;
      }
      else
        vim_free(ptr);
--- 2438,2449 ----
       * otherwise CTRL-O w and then <Left> will clear "last_insert".
       */
      ptr = get_inserted();
!     int added = ptr == NULL ? 0 : (int)STRLEN(ptr) - new_insert_skip;
!     if (did_restart_edit == 0 || added > 0)
      {
        vim_free(last_insert);
        last_insert = ptr;
!       last_insert_skip = added < 0 ? 0 : new_insert_skip;
      }
      else
        vim_free(ptr);
*** ../vim-9.0.1428/src/version.c       2023-03-25 20:06:10.504816579 +0000
--- src/version.c       2023-03-26 21:25:00.682861828 +0100
***************
*** 697,698 ****
--- 697,700 ----
  {   /* Add new patch number below this line */
+ /**/
+     1429,
  /**/

-- 
GUARD #2:  Wait a minute -- supposing two swallows carried it together?
GUARD #1:  No, they'd have to have it on a line.
GUARD #2:  Well, simple!  They'd just use a standard creeper!
GUARD #1:  What, held under the dorsal guiding feathers?
GUARD #2:  Well, why not?
                                  The Quest for the Holy Grail (Monty Python)

 /// 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/20230326202817.843051C129B%40moolenaar.net.

Raspunde prin e-mail lui