To: vim_dev@googlegroups.com Subject: Patch 8.2.3116 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.3116 Problem: Vim9: crash when debugging a function with line continuation. Solution: Check for a NULL pointer. (closes #8521) Files: src/vim9execute.c, src/testdir/test_debugger.vim *** ../vim-8.2.3115/src/vim9execute.c 2021-06-30 20:39:11.366130953 +0200 --- src/vim9execute.c 2021-07-07 20:09:55.648540071 +0200 *************** *** 1497,1505 **** ga_init2(&ga, sizeof(char_u *), 10); for (lnum = iptr->isn_lnum; lnum < end_lnum; ++lnum) { ! char_u *p = skipwhite( ! ((char_u **)ufunc->uf_lines.ga_data)[lnum - 1]); if (*p == '#') break; if (ga_grow(&ga, 1) == OK) --- 1497,1507 ---- ga_init2(&ga, sizeof(char_u *), 10); for (lnum = iptr->isn_lnum; lnum < end_lnum; ++lnum) { ! char_u *p = ((char_u **)ufunc->uf_lines.ga_data)[lnum - 1]; + if (p == NULL) + continue; // left over from continuation line + p = skipwhite(p); if (*p == '#') break; if (ga_grow(&ga, 1) == OK) *** ../vim-8.2.3115/src/testdir/test_debugger.vim 2021-07-04 12:30:00.215304320 +0200 --- src/testdir/test_debugger.vim 2021-07-07 20:09:05.040636021 +0200 *************** *** 1009,1014 **** --- 1009,1015 ---- eval 1 enddef enddef + def g:FuncComment() # comment echo "first" *************** *** 1016,1021 **** --- 1017,1023 ---- # comment echo "second" enddef + def g:FuncForLoop() eval 1 for i in [11, 22, 33] *************** *** 1023,1028 **** --- 1025,1035 ---- endfor echo "done" enddef + + def g:FuncWithSplitLine() + eval 1 + | eval 2 + enddef END call writefile(file, 'Xtest.vim') *************** *** 1078,1083 **** --- 1085,1096 ---- call RunDbgCmd(buf, 'next', ['function FuncForLoop', 'line 2: for i in [11, 22, 33]']) call RunDbgCmd(buf, 'echo i', ['22']) + call RunDbgCmd(buf, 'breakdel *') + call RunDbgCmd(buf, 'cont') + + call RunDbgCmd(buf, ':breakadd func FuncWithSplitLine') + call RunDbgCmd(buf, ':call FuncWithSplitLine()', ['function FuncWithSplitLine', 'line 1: eval 1 | eval 2']) + call RunDbgCmd(buf, 'cont') call StopVimInTerminal(buf) call delete('Xtest.vim') *** ../vim-8.2.3115/src/version.c 2021-07-07 19:26:15.929533940 +0200 --- src/version.c 2021-07-07 20:00:58.249568418 +0200 *************** *** 757,758 **** --- 757,760 ---- { /* Add new patch number below this line */ + /**/ + 3116, /**/ -- I AM THANKFUL... ...for a lawn that needs mowing, windows that need cleaning and gutters that need fixing because it means I have a home. /// 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 ///