Patch 8.2.4622
Problem:    Vim9: Crash with :execute and :finish. (Sergey Vlasov)
Solution:   Check for NULL. (closes #10011)
Files:      src/eval.c, src/testdir/test_vim9_script.vim


*** ../vim-8.2.4621/src/eval.c  2022-03-19 12:56:42.529503830 +0000
--- src/eval.c  2022-03-25 11:03:01.397707340 +0000
***************
*** 2144,2150 ****
        p = skipwhite(next);
        if (*p != NUL && !vim9_comment_start(p))
            return next;
!       (void)eval_next_line(evalarg);
      }
      return NULL;
  }
--- 2144,2151 ----
        p = skipwhite(next);
        if (*p != NUL && !vim9_comment_start(p))
            return next;
!       if (eval_next_line(evalarg) == NULL)
!           break;
      }
      return NULL;
  }
***************
*** 2199,2204 ****
--- 2200,2208 ----
                                                           GETLINE_CONCAT_ALL);
      else
        line = next_line_from_context(evalarg->eval_cctx, TRUE);
+     if (line == NULL)
+       return NULL;
+ 
      ++evalarg->eval_break_count;
      if (gap->ga_itemsize > 0 && ga_grow(gap, 1) == OK)
      {
*** ../vim-8.2.4621/src/testdir/test_vim9_script.vim    2022-03-20 
21:14:08.438143810 +0000
--- src/testdir/test_vim9_script.vim    2022-03-25 10:55:20.686499704 +0000
***************
*** 1830,1835 ****
--- 1830,1853 ----
    v9.CheckScriptSuccess(lines)
  enddef
  
+ def Test_execute_finish()
+   # the empty lines are relevant here
+   var lines =<< trim END
+       vim9script
+ 
+       var vname = "g:hello"
+ 
+       if exists(vname) | finish | endif | execute vname '= "world"'
+ 
+       assert_equal('world', g:hello)
+ 
+       if exists(vname) | finish | endif | execute vname '= "world"'
+ 
+       assert_report('should not be reached')
+   END
+   v9.CheckScriptSuccess(lines)
+ enddef
+ 
  def Test_echo_cmd()
    echo 'some' # comment
    echon 'thing'
*** ../vim-8.2.4621/src/version.c       2022-03-24 18:04:42.733613365 +0000
--- src/version.c       2022-03-25 10:50:46.230940939 +0000
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     4622,
  /**/

-- 
ARTHUR:  Well, I AM king...
DENNIS:  Oh king, eh, very nice.  An' how'd you get that, eh?  By exploitin'
         the workers -- by 'angin' on to outdated imperialist dogma which
         perpetuates the economic an' social differences in our society!  If
         there's ever going to be any progress--
                                  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/20220325111708.61BB41C0C20%40moolenaar.net.

Raspunde prin e-mail lui