diff options
author | Bram Moolenaar <Bram@vim.org> | 2023-01-04 14:31:49 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2023-01-04 14:31:49 +0000 |
commit | 7b17eb4b063a234376c1ec909ee293e42cff290c (patch) | |
tree | f994c89ecf171083a5d8e5a718a21626a7ba5e08 | |
parent | f057171d8b562c72334fd7c15c89ff787358ce3a (diff) | |
download | vim-git-7b17eb4b063a234376c1ec909ee293e42cff290c.tar.gz |
patch 9.0.1143: invalid memory access with bad 'statusline' valuev9.0.1143
Problem: Invalid memory access with bad 'statusline' value.
Solution: Avoid going over the NUL at the end.
-rw-r--r-- | src/buffer.c | 2 | ||||
-rw-r--r-- | src/testdir/test_statusline.vim | 7 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 11 insertions, 0 deletions
diff --git a/src/buffer.c b/src/buffer.c index 985689878..401682261 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -4617,6 +4617,8 @@ build_stl_str_hl( #endif if (vim_strchr(STL_ALL, *s) == NULL) { + if (*s == NUL) // can happen with "%0" + break; s++; continue; } diff --git a/src/testdir/test_statusline.vim b/src/testdir/test_statusline.vim index a82959765..23613bfed 100644 --- a/src/testdir/test_statusline.vim +++ b/src/testdir/test_statusline.vim @@ -440,6 +440,13 @@ func Test_statusline() set splitbelow& endfunc +func Test_statusline_trailing_percent_zero() + " this was causing illegal memory access + set laststatus=2 stl=%!%0 + call assert_fails('redraw', 'E15: Invalid expression: "%0"') + set laststatus& stl& +endfunc + func Test_statusline_visual() func CallWordcount() call wordcount() diff --git a/src/version.c b/src/version.c index df02bb87b..4ccbd537a 100644 --- a/src/version.c +++ b/src/version.c @@ -696,6 +696,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1143, +/**/ 1142, /**/ 1141, |