To: vim_dev@googlegroups.com Subject: Patch 9.0.0552 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ 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 \ ? '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 -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///