diff src/testdir/test_cmdline.vim @ 28741:b44f15083faf v8.2.4895

patch 8.2.4895: buffer overflow with invalid command with composing chars Commit: https://github.com/vim/vim/commit/d88934406c5375d88f8f1b65331c9f0cab68cc6c Author: Bram Moolenaar <Bram@vim.org> Date: Fri May 6 20:38:47 2022 +0100 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.
author Bram Moolenaar <Bram@vim.org>
date Fri, 06 May 2022 21:45:02 +0200
parents 80085afc2f4d
children 4a9fdf708575
line wrap: on
line diff
--- a/src/testdir/test_cmdline.vim
+++ b/src/testdir/test_cmdline.vim
@@ -3353,6 +3353,17 @@ func Test_cmdline_complete_scriptnames()
   set wildmenu&
 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()