Patch 9.0.0552
Problem:    Crash when using NUL in buffer that uses :source.
Solution:   Don't get a next line when skipping over NL.
Files:      src/eval.c, src/testdir/test_source.vim


*** ../vim-9.0.0551/src/eval.c  2022-09-19 15:54:29.543117874 +0100
--- src/eval.c  2022-09-22 21:32:25.337713395 +0100
***************
*** 253,259 ****
            if (fc == NULL)
                return FAIL;
  
!           // Shortcut to call a compiled function without overhead.
            r = call_def_function(partial->pt_func, argc, argv,
                                          DEF_USE_PT_ARGV, partial, fc, rettv);
            remove_funccal();
--- 253,259 ----
            if (fc == NULL)
                return FAIL;
  
!           // Shortcut to call a compiled function with minimal overhead.
            r = call_def_function(partial->pt_func, argc, argv,
                                          DEF_USE_PT_ARGV, partial, fc, rettv);
            remove_funccal();
***************
*** 2291,2297 ****
  
        if (next != NULL)
        {
!           *getnext = TRUE;
            return skipwhite(next);
        }
      }
--- 2291,2297 ----
  
        if (next != NULL)
        {
!           *getnext = *p != NL;
            return skipwhite(next);
        }
      }
*** ../vim-9.0.0551/src/testdir/test_source.vim 2022-09-02 21:55:45.507049444 
+0100
--- src/testdir/test_source.vim 2022-09-22 21:29:20.938093248 +0100
***************
*** 665,669 ****
--- 665,686 ----
    call delete('Xtest.vim')
  endfunc
  
+ func Test_source_buffer_with_NUL_char()
+   " This was trying to use a line below the buffer.
+   let lines =<< trim END
+       if !exists('g:loaded')
+         let g:loaded = 1
+         source
+       endif
+   END
+   " Can't have a NL in heredoc
+   let lines += ["silent! vim9 echo [0 \<NL> ? 'a' : 'b']"]
+   call writefile(lines, 'XsourceNul', '')
+   edit XsourceNul
+   source
+ 
+   bwipe!
+ endfunc
+ 
  
  " vim: shiftwidth=2 sts=2 expandtab
*** ../vim-9.0.0551/src/version.c       2022-09-22 19:02:34.780908293 +0100
--- src/version.c       2022-09-22 21:34:58.041452705 +0100
***************
*** 701,702 ****
--- 701,704 ----
  {   /* Add new patch number below this line */
+ /**/
+     552,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
136. You decide to stay in a low-paying job teaching just for the
     free Internet access.

 /// 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/20220922203626.60A841C0796%40moolenaar.net.

Raspunde prin e-mail lui