summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-07-07 20:10:43 +0200
committerBram Moolenaar <Bram@vim.org>2021-07-07 20:10:43 +0200
commit303215d60cece0462f040035502b5bc95373bd6e (patch)
tree7205c8883ce386de1d5b6819dff26f399b8f01c8
parentb5098060f4acae4dac3203130278c948d670a3d5 (diff)
downloadvim-git-303215d60cece0462f040035502b5bc95373bd6e.tar.gz
patch 8.2.3116: Vim9: crash when debugging a function with line continuationv8.2.3116
Problem: Vim9: crash when debugging a function with line continuation. Solution: Check for a NULL pointer. (closes #8521)
-rw-r--r--src/testdir/test_debugger.vim13
-rw-r--r--src/version.c2
-rw-r--r--src/vim9execute.c6
3 files changed, 19 insertions, 2 deletions
diff --git a/src/testdir/test_debugger.vim b/src/testdir/test_debugger.vim
index 97e115bf3..5b12c5877 100644
--- a/src/testdir/test_debugger.vim
+++ b/src/testdir/test_debugger.vim
@@ -1009,6 +1009,7 @@ func Test_debug_def_function()
eval 1
enddef
enddef
+
def g:FuncComment()
# comment
echo "first"
@@ -1016,6 +1017,7 @@ func Test_debug_def_function()
# comment
echo "second"
enddef
+
def g:FuncForLoop()
eval 1
for i in [11, 22, 33]
@@ -1023,6 +1025,11 @@ func Test_debug_def_function()
endfor
echo "done"
enddef
+
+ def g:FuncWithSplitLine()
+ eval 1
+ | eval 2
+ enddef
END
call writefile(file, 'Xtest.vim')
@@ -1078,6 +1085,12 @@ func Test_debug_def_function()
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')
diff --git a/src/version.c b/src/version.c
index e2f74e926..1deb3e482 100644
--- a/src/version.c
+++ b/src/version.c
@@ -756,6 +756,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 3116,
+/**/
3115,
/**/
3114,
diff --git a/src/vim9execute.c b/src/vim9execute.c
index b194e6a2a..87f3c424e 100644
--- a/src/vim9execute.c
+++ b/src/vim9execute.c
@@ -1497,9 +1497,11 @@ handle_debug(isn_T *iptr, ectx_T *ectx)
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]);
+ 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)