aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Dewar <seandewar@users.noreply.github.com>2022-02-16 21:23:08 +0000
committerSean Dewar <seandewar@users.noreply.github.com>2022-02-17 14:45:22 +0000
commitb149665689f84ee7297ab5ce8a8eb59b12611af1 (patch)
tree50cfedbcea6400def5ad182307b5807b78e378c9
parenta256b710a26db5c08447eee3e602b86c13c78b06 (diff)
downloadrneovim-b149665689f84ee7297ab5ce8a8eb59b12611af1.tar.gz
rneovim-b149665689f84ee7297ab5ce8a8eb59b12611af1.tar.bz2
rneovim-b149665689f84ee7297ab5ce8a8eb59b12611af1.zip
vim-patch:8.2.3573: cannot decide whether to skip test that fails with 64 bit
Problem: Cannot decide whether to skip test that fails with 64 bit ints. (closes vim/vim#9072) Solution: Add v:sizeofint, v:sizeoflong and v:sizeofpointer. Improve the check for multiply overflow. https://github.com/vim/vim/commit/69b3072d984480935ec412b32b97fea974d2b689 Omit v:sizeof{int,long,pointer} as they're only really used for tests.
-rw-r--r--runtime/doc/vim_diff.txt3
-rw-r--r--src/nvim/ops.c3
-rw-r--r--src/nvim/testdir/test_put.vim7
3 files changed, 5 insertions, 8 deletions
diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt
index 385ce34d70..5ea6a9c5dd 100644
--- a/runtime/doc/vim_diff.txt
+++ b/runtime/doc/vim_diff.txt
@@ -494,6 +494,9 @@ Eval:
*js_encode()*
*js_decode()*
*v:none* (used by Vim to represent JavaScript "undefined"); use |v:null| instead.
+ *v:sizeofint*
+ *v:sizeoflong*
+ *v:sizeofpointer*
Events:
*SigUSR1* Use |Signal| to detect `SIGUSR1` signal instead.
diff --git a/src/nvim/ops.c b/src/nvim/ops.c
index e6e617a419..2218b079b0 100644
--- a/src/nvim/ops.c
+++ b/src/nvim/ops.c
@@ -3434,7 +3434,8 @@ void do_put(int regname, yankreg_T *reg, int dir, long count, int flags)
const long multlen = count * yanklen;
totlen = (size_t)(int)multlen;
- if (totlen != (size_t)multlen) {
+ if (totlen != (size_t)multlen || (long)totlen / count != yanklen
+ || (long)totlen / yanklen != count) {
emsg(_(e_resulting_text_too_long));
break;
} else if (totlen > 0) {
diff --git a/src/nvim/testdir/test_put.vim b/src/nvim/testdir/test_put.vim
index a159687a76..bf222477a2 100644
--- a/src/nvim/testdir/test_put.vim
+++ b/src/nvim/testdir/test_put.vim
@@ -139,13 +139,6 @@ func Test_p_with_count_leaves_mark_at_end()
endfunc
func Test_very_large_count()
- " FIXME: should actually check if sizeof(int) == sizeof(long)
- CheckNotMSWindows
-
- if v:numbersize != 64
- throw 'Skipped: only works with 64 bit numbers'
- endif
-
new
let @" = 'x'
call assert_fails('norm 44444444444444p', 'E1240:')