From c366a63e4cdd97fc2818be348186a18e1b6eb8df Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 24 Aug 2022 21:08:17 +0800 Subject: vim-patch:9.0.0045: reading past end of completion with a long line Problem: Reading past end of completion with a long line and 'infercase' set. Solution: Allocate the string if needed. https://github.com/vim/vim/commit/caea66442d86e7bbba3bf3dc202c3c0d549b9853 Cherry-pick the deletion of a blank line from patch 9.0.0027. N/A patches for version.c: vim-patch:9.0.0054: compiler warning for size_t to int conversion Problem: Compiler warning for size_t to int conversion. Solution: Add type cast. (Mike Williams, closes vim/vim#10741) https://github.com/vim/vim/commit/c7bd2f08e531f08723cdc677212a3633d11c9a97 --- src/nvim/testdir/test_ins_complete.vim | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_ins_complete.vim b/src/nvim/testdir/test_ins_complete.vim index 54d3844100..6c59041451 100644 --- a/src/nvim/testdir/test_ins_complete.vim +++ b/src/nvim/testdir/test_ins_complete.vim @@ -954,5 +954,20 @@ func Test_complete_overrun() bwipe! endfunc +func Test_infercase_very_long_line() + " this was truncating the line when inferring case + new + let longLine = "blah "->repeat(300) + let verylongLine = "blah "->repeat(400) + call setline(1, verylongLine) + call setline(2, longLine) + set ic infercase + exe "normal 2Go\\\" + call assert_equal(longLine, getline(3)) + + bwipe! + set noic noinfercase +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit From 5d1f0c3eca9675bfdeb75402ec3340d05cc34732 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 24 Aug 2022 21:40:14 +0800 Subject: vim-patch:9.0.0046: reading past end of completion with duplicate match Problem: Reading past end of completion with duplicate match. Solution: Check string length https://github.com/vim/vim/commit/baefde14550231f6468ac2ed2ed495bc381c0c92 --- src/nvim/testdir/test_ins_complete.vim | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_ins_complete.vim b/src/nvim/testdir/test_ins_complete.vim index 6c59041451..cd7d83c8ea 100644 --- a/src/nvim/testdir/test_ins_complete.vim +++ b/src/nvim/testdir/test_ins_complete.vim @@ -969,5 +969,15 @@ func Test_infercase_very_long_line() set noic noinfercase endfunc +func Test_ins_complete_add() + " this was reading past the end of allocated memory + new + norm o + norm 7o€€ + sil! norm o + + bwipe! +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit From 6680002169a8cc505186e81acc161bec40658d73 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 24 Aug 2022 21:44:37 +0800 Subject: vim-patch:9.0.0060: accessing uninitialized memory when completing long line Problem: Accessing uninitialized memory when completing long line. Solution: Terminate string with NUL. https://github.com/vim/vim/commit/b9e717367c395490149495cf375911b5d9de889e --- src/nvim/testdir/test_ins_complete.vim | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_ins_complete.vim b/src/nvim/testdir/test_ins_complete.vim index cd7d83c8ea..9aa3881724 100644 --- a/src/nvim/testdir/test_ins_complete.vim +++ b/src/nvim/testdir/test_ins_complete.vim @@ -965,6 +965,13 @@ func Test_infercase_very_long_line() exe "normal 2Go\\\" call assert_equal(longLine, getline(3)) + " check that the too long text is NUL terminated + %del + norm o + norm 1987ax + exec "norm ox\\" + call assert_equal(repeat('x', 1987), getline(3)) + bwipe! set noic noinfercase endfunc -- cgit From dd77a0062108d6ecfc00bbc50b0d6d738df0b89d Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 24 Aug 2022 21:46:06 +0800 Subject: vim-patch:9.0.0102: reading past end of line with insert mode completion Problem: Reading past end of line with insert mode completion. Solution: Check text length. https://github.com/vim/vim/commit/a6f9e300161f4cb54713da22f65b261595e8e614 --- src/nvim/testdir/test_ins_complete.vim | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_ins_complete.vim b/src/nvim/testdir/test_ins_complete.vim index 9aa3881724..8f7d2cb278 100644 --- a/src/nvim/testdir/test_ins_complete.vim +++ b/src/nvim/testdir/test_ins_complete.vim @@ -986,5 +986,13 @@ func Test_ins_complete_add() bwipe! endfunc +func Test_ins_complete_end_of_line() + " this was reading past the end of the line + new + norm 8o€ý  + sil! norm o + + bwipe! +endfunc " vim: shiftwidth=2 sts=2 expandtab -- cgit