From 0cf0be302beb3029d245814eca427f4a4ebd2f67 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 24 Jun 2022 06:25:34 +0800 Subject: vim-patch:8.2.4895: buffer overflow with invalid command with composing chars Problem: Buffer overflow with invalid command with composing chars. Solution: Check that the whole character fits in the buffer. https://github.com/vim/vim/commit/d88934406c5375d88f8f1b65331c9f0cab68cc6c --- src/nvim/testdir/test_cmdline.vim | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/nvim/testdir/test_cmdline.vim') diff --git a/src/nvim/testdir/test_cmdline.vim b/src/nvim/testdir/test_cmdline.vim index 4630ddd6e7..887c8e1593 100644 --- a/src/nvim/testdir/test_cmdline.vim +++ b/src/nvim/testdir/test_cmdline.vim @@ -1220,6 +1220,17 @@ func Test_recalling_cmdline() cunmap (save-cmdline) endfunc +" this was going over the end of IObuff +func Test_report_error_with_composing() + let caught = 'no' + try + exe repeat('0', 987) .. "0\xdd\x80\xdd\x80\xdd\x80\xdd\x80" + catch /E492:/ + let caught = 'yes' + endtry + call assert_equal('yes', caught) +endfunc + " Test for expanding 2-letter and 3-letter :substitute command arguments. " These commands don't accept an argument. func Test_cmdline_complete_substitute_short() -- cgit