From 3344cffe7bf77c984550c01f9405f4d757150d8a Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Fri, 13 Sep 2019 18:15:09 -0700 Subject: getdigits: introduce `strict`, `def` parameters Problem: During a refactor long ago, we changed the `getdigits_*` familiy of functions to abort on overflow. But this is often wrong, because many of these codepaths are handling user input. Solution: Decide at each call-site whether to use "strict" mode. fix #5555 --- test/functional/ex_cmds/excmd_spec.lua | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 test/functional/ex_cmds/excmd_spec.lua (limited to 'test/functional/ex_cmds/excmd_spec.lua') diff --git a/test/functional/ex_cmds/excmd_spec.lua b/test/functional/ex_cmds/excmd_spec.lua new file mode 100644 index 0000000000..aac2a9f469 --- /dev/null +++ b/test/functional/ex_cmds/excmd_spec.lua @@ -0,0 +1,32 @@ +local helpers = require("test.functional.helpers")(after_each) +local command = helpers.command +local eq = helpers.eq +local clear = helpers.clear +local pcall_err = helpers.pcall_err +local assert_alive = helpers.assert_alive + +describe('Ex cmds', function() + before_each(function() + clear() + end) + + it('handle integer overflow from user-input #5555', function() + command(':9999999999999999999999999999999999999999') + command(':later 9999999999999999999999999999999999999999') + command(':echo expand("#<9999999999999999999999999999999999999999")') + command(':lockvar 9999999999999999999999999999999999999999') + command(':winsize 9999999999999999999999999999999999999999 9999999999999999999999999999999999999999') + eq('Vim(tabnext):E474: Invalid argument', + pcall_err(command, ':tabnext 9999999999999999999999999999999999999999')) + eq('Vim(Next):E939: Positive count required', + pcall_err(command, ':N 9999999999999999999999999999999999999999')) + eq('Vim(menu):E329: No menu "9999999999999999999999999999999999999999"', + pcall_err(command, ':menu 9999999999999999999999999999999999999999')) + eq('Vim(bdelete):E939: Positive count required', + pcall_err(command, ':bdelete 9999999999999999999999999999999999999999')) + eq('Vim(retab):E487: Argument must be positive', + pcall_err(command, ':retab 9999999999999999999999999999999999999999')) + assert_alive() + end) +end) + -- cgit