mirror of
https://github.com/neovim/neovim.git
synced 2025-09-29 14:38:32 +00:00
vim-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 vim/vim#5470)
02ad46394e
This commit is contained in:
@@ -461,6 +461,9 @@ cin_iscase (
|
|||||||
if (cin_starts_with(s, "case")) {
|
if (cin_starts_with(s, "case")) {
|
||||||
for (s += 4; *s; ++s) {
|
for (s += 4; *s; ++s) {
|
||||||
s = cin_skipcomment(s);
|
s = cin_skipcomment(s);
|
||||||
|
if (*s == NUL) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (*s == ':') {
|
if (*s == ':') {
|
||||||
if (s[1] == ':') /* skip over "::" for C++ */
|
if (s[1] == ':') /* skip over "::" for C++ */
|
||||||
++s;
|
++s;
|
||||||
|
@@ -118,4 +118,13 @@ b = something();
|
|||||||
bw!
|
bw!
|
||||||
endfunc
|
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
|
" vim: shiftwidth=2 sts=2 expandtab
|
||||||
|
Reference in New Issue
Block a user