Permalink
Browse files

patch 8.0.1346: crash when passing 50 char string to balloon_split()

Problem:    Crash when passing 50 char string to balloon_split().
Solution:   Fix off-by-one error.
  • Loading branch information...
brammool committed Nov 26, 2017
1 parent c41838a commit a3571ebef5a2969d16e3e202ec4bca8858aca6ba
Showing with 7 additions and 1 deletion.
  1. +1 −1 src/popupmnu.c
  2. +4 −0 src/testdir/test_popup.vim
  3. +2 −0 src/version.c
View
@@ -836,7 +836,7 @@ split_message(char_u *mesg, pumitem_T **array)
item->bytelen = p - item->start;
if (item->cells > max_cells)
max_cells = item->cells;
long_item_count += item->cells / BALLOON_MIN_WIDTH;
long_item_count += (item->cells - 1) / BALLOON_MIN_WIDTH;
}
height = 2 + ga.ga_len;
@@ -707,6 +707,10 @@ func Test_balloon_split()
if !exists('*balloon_split')
return
endif
call assert_equal([
\ 'tempname: 0x555555e380a0 "/home/mool/.viminfz.tmp"',
\ ], balloon_split(
\ 'tempname: 0x555555e380a0 "/home/mool/.viminfz.tmp"'))
call assert_equal([
\ 'one two three four one two three four one two thre',
\ 'e four',
View
@@ -771,6 +771,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1346,
/**/
1345,
/**/

0 comments on commit a3571eb

Please sign in to comment.