diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-10-05 21:58:53 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-10-05 21:58:53 +0100 |
commit | 78e0fa4cf4fcd563c0bc8c87afa54d4f5dc22020 (patch) | |
tree | f1fe10b941628fde42efa4e489fe9b2310888624 /src | |
parent | 2e258bd79f403bcccb1336bea70803957a83808f (diff) | |
download | vim-git-78e0fa4cf4fcd563c0bc8c87afa54d4f5dc22020.tar.gz |
patch 8.2.3482: reading beyond end of line ending in quote and backslashv8.2.3482
Problem: Reading beyond end of line ending in quote and backslash.
Solution: Check for non-NUL after backslash. (closes #8964)
Diffstat (limited to 'src')
-rw-r--r-- | src/cindent.c | 4 | ||||
-rw-r--r-- | src/testdir/test_cindent.vim | 7 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 11 insertions, 2 deletions
diff --git a/src/cindent.c b/src/cindent.c index b75120653..850a36994 100644 --- a/src/cindent.c +++ b/src/cindent.c @@ -82,10 +82,10 @@ skip_string(char_u *p) { if (p[0] == '\'') // 'c' or '\n' or '\000' { - if (!p[1]) // ' at end of line + if (p[1] == NUL) // ' at end of line break; i = 2; - if (p[1] == '\\') // '\n' or '\000' + if (p[1] == '\\' && p[2] != NUL) // '\n' or '\000' { ++i; while (vim_isdigit(p[i - 1])) // '\000' diff --git a/src/testdir/test_cindent.vim b/src/testdir/test_cindent.vim index 5926408d2..3a536c4c8 100644 --- a/src/testdir/test_cindent.vim +++ b/src/testdir/test_cindent.vim @@ -5307,4 +5307,11 @@ func Test_cindent_pragma() enew! | close endfunc +func Test_backslash_at_end_of_line() + new + exe "norm v>O'\\\<C-m>-" + exe "norm \<C-q>=" + bwipe! +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/version.c b/src/version.c index 31fb2a618..b0049e00f 100644 --- a/src/version.c +++ b/src/version.c @@ -758,6 +758,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 3482, +/**/ 3481, /**/ 3480, |