From 3ed800e998e22a975e17ee54e675410148850c75 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 18 Feb 2022 08:29:55 +0800 Subject: vim-patch:8.2.3659: integer overflow with large line number Problem: Integer overflow with large line number. Solution: Check for overflow. (closes vim/vim#9202) https://github.com/vim/vim/commit/03725c5795ae5b8c14da4a39cd0ce723c6dd4304 Put E1247 in globals.h as E1240 is also there. Do not make getdigits() abort. --- test/functional/legacy/excmd_spec.lua | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 test/functional/legacy/excmd_spec.lua (limited to 'test') diff --git a/test/functional/legacy/excmd_spec.lua b/test/functional/legacy/excmd_spec.lua new file mode 100644 index 0000000000..174f7d292e --- /dev/null +++ b/test/functional/legacy/excmd_spec.lua @@ -0,0 +1,32 @@ +local helpers = require('test.functional.helpers')(after_each) +local clear = helpers.clear +local exec_lua = helpers.exec_lua +local meths = helpers.meths +local source = helpers.source +local eq = helpers.eq + +local function sizeoflong() + if not exec_lua('return pcall(require, "ffi")') then + pending('missing LuaJIT FFI') + end + return exec_lua('return require("ffi").sizeof(require("ffi").typeof("long"))') +end + +describe('Ex command', function() + before_each(clear) + after_each(function() eq({}, meths.get_vvar('errors')) end) + + it('checks for address line overflow', function() + if sizeoflong() < 8 then + pending('Skipped: only works with 64 bit long ints') + end + + source [[ + new + call setline(1, 'text') + call assert_fails('|.44444444444444444444444', 'E1247:') + call assert_fails('|.9223372036854775806', 'E1247:') + bwipe! + ]] + end) +end) -- cgit From 62a1290758a3cd6af95dc47a3bbdc7dcf290d531 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 18 Feb 2022 08:55:00 +0800 Subject: vim-patch:8.2.3661: test for put with large count fails Problem: Test for put with large count fails. Solution: Adjust the counts in the test. https://github.com/vim/vim/commit/8bc07e800c2af36686aadd4178cc2671f5c454d4 --- test/functional/legacy/put_spec.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'test') diff --git a/test/functional/legacy/put_spec.lua b/test/functional/legacy/put_spec.lua index 0b969dee55..3ddf65490e 100644 --- a/test/functional/legacy/put_spec.lua +++ b/test/functional/legacy/put_spec.lua @@ -23,8 +23,8 @@ describe('put', function() source [[ new - let @" = 'x' - call assert_fails('norm 44444444444444p', 'E1240:') + let @" = repeat('x', 100) + call assert_fails('norm 999999999p', 'E1240:') bwipe! ]] end) @@ -36,9 +36,9 @@ describe('put', function() source [[ new - call setline(1, 'x') - exe "norm \y" - call assert_fails('norm 44444444444444p', 'E1240:') + call setline(1, repeat('x', 100)) + exe "norm \$y" + call assert_fails('norm 999999999p', 'E1240:') bwipe! ]] end) -- cgit