1
0
forked from aniani/vim

patch 8.0.0561: undefined behavior when using backslash after empty line

Problem:    Undefined behavior when using backslash after empty line.
Solution:   Check for an empty line. (Dominique Pelle, closes #1631)
This commit is contained in:
Bram Moolenaar
2017-04-10 22:22:42 +02:00
parent 451a4a1cb7
commit 478af67dd6
3 changed files with 14 additions and 1 deletions

View File

@@ -2129,7 +2129,7 @@ ga_concat(garray_T *gap, char_u *s)
{ {
int len; int len;
if (s == NULL) if (s == NULL || *s == NUL)
return; return;
len = (int)STRLEN(s); len = (int)STRLEN(s);
if (ga_grow(gap, len) == OK) if (ga_grow(gap, len) == OK)

View File

@@ -1309,6 +1309,17 @@ func Test_script_lines()
endtry endtry
endfunc endfunc
"-------------------------------------------------------------------------------
" Test 96: line continuation {{{1
"
" Undefined behavior was detected by ubsan with line continuation
" after an empty line.
"-------------------------------------------------------------------------------
func Test_script_emty_line_continuation()
\
endfunc
"------------------------------------------------------------------------------- "-------------------------------------------------------------------------------
" Modelines {{{1 " Modelines {{{1
" vim: ts=8 sw=4 tw=80 fdm=marker " vim: ts=8 sw=4 tw=80 fdm=marker

View File

@@ -764,6 +764,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
561,
/**/ /**/
560, 560,
/**/ /**/