Patch 9.0.0360
Problem:    Crash when invalid line number on :for is ignored.
Solution:   Do not check breakpoint for non-existing line.
Files:      src/ex_docmd.c, src/testdir/test_eval_stuff.vim


*** ../vim-9.0.0359/src/ex_docmd.c      2022-09-01 16:00:49.730496296 +0100
--- src/ex_docmd.c      2022-09-02 16:43:37.859130862 +0100
***************
*** 1068,1074 ****
  
                    // Check for the next breakpoint at or after the ":while"
                    // or ":for".
!                   if (breakpoint != NULL)
                    {
                        *breakpoint = dbg_find_breakpoint(
                               getline_equal(fgetline, cookie, getsourceline),
--- 1068,1074 ----
  
                    // Check for the next breakpoint at or after the ":while"
                    // or ":for".
!                   if (breakpoint != NULL && lines_ga.ga_len > current_line)
                    {
                        *breakpoint = dbg_find_breakpoint(
                               getline_equal(fgetline, cookie, getsourceline),
*** ../vim-9.0.0359/src/testdir/test_eval_stuff.vim     2022-08-16 
17:50:33.959764427 +0100
--- src/testdir/test_eval_stuff.vim     2022-09-02 16:45:30.719094486 +0100
***************
*** 1,6 ****
--- 1,7 ----
  " Tests for various eval things.
  
  source view_util.vim
+ source shared.vim
  
  function s:foo() abort
    try
***************
*** 87,92 ****
--- 88,105 ----
    let &enc = save_enc
  endfunc
  
+ func Test_for_invalid_line_count()
+   let lines =<< trim END
+       111111111111111111111111 for line in ['one']
+       endfor
+   END
+   call writefile(lines, 'XinvalidFor')
+   " only test that this doesn't crash
+   call RunVim([], [], '-u NONE -e -s -S XinvalidFor -c qa')
+ 
+   call delete('XinvalidFor')
+ endfunc
+ 
  func Test_readfile_binary()
    new
    call setline(1, ['one', 'two', 'three'])
*** ../vim-9.0.0359/src/version.c       2022-09-02 15:15:11.067569180 +0100
--- src/version.c       2022-09-02 16:30:10.915340578 +0100
***************
*** 709,710 ****
--- 709,712 ----
  {   /* Add new patch number below this line */
+ /**/
+     360,
  /**/

-- 
I once paid $12 to peer at the box that held King Tutankhamen's little
bandage-covered midget corpse at the De Young Museum in San Francisco.  I
remember thinking how pleased he'd be about the way things turned out in his
afterlife.
                                (Scott Adams - The Dilbert principle)

 /// 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/20220902154904.EFEA21C0BD8%40moolenaar.net.

Raspunde prin e-mail lui