Mercurial > vim
changeset 19104:9f4648953f1a v8.2.0112
patch 8.2.0112: illegal memory access when using 'cindent'
Commit: https://github.com/vim/vim/commit/02ad46394e8f887b60fda994f8a5da2ac1937b23
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jan 12 13:48:18 2020 +0100
patch 8.2.0112: illegal memory access when using 'cindent'
Problem: Illegal memory access when using 'cindent'.
Solution: Check for NUL byte. (Dominique Pelle, closes https://github.com/vim/vim/issues/5470)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 12 Jan 2020 14:00:04 +0100 |
parents | 8d183ace1c33 |
children | 7024ec2417e7 |
files | src/cindent.c src/testdir/test_cindent.vim src/version.c |
diffstat | 3 files changed, 13 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/cindent.c +++ b/src/cindent.c @@ -582,6 +582,8 @@ cin_iscase( for (s += 4; *s; ++s) { s = cin_skipcomment(s); + if (*s == NUL) + break; if (*s == ':') { if (s[1] == ':') // skip over "::" for C++
--- a/src/testdir/test_cindent.vim +++ b/src/testdir/test_cindent.vim @@ -5251,4 +5251,13 @@ func Test_cindent_56() enew! | close endfunc +" this was going beyond the end of the line. +func Test_cindent_case() + new + call setline(1, "case x: // x") + set cindent + norm! f:a: + bwipe! +endfunc + " vim: shiftwidth=2 sts=2 expandtab