patch 8.2.3601: check for overflow in put count does not work well
Problem: Check for overflow in put count does not work well.
Solution: Improve the overflow check. (Ozaki Kiichi, closes #9102)
diff --git a/src/testdir/test_put.vim b/src/testdir/test_put.vim
index b2f2120..8e9f332 100644
--- a/src/testdir/test_put.vim
+++ b/src/testdir/test_put.vim
@@ -149,8 +149,16 @@
endfunc
func Test_very_large_count()
- if v:sizeofint != 8
- throw 'Skipped: only works with 64 bit ints'
+ new
+ " total put-length (21474837 * 100) brings 32 bit int overflow
+ let @" = repeat('x', 100)
+ call assert_fails('norm 21474837p', 'E1240:')
+ bwipe!
+endfunc
+
+func Test_very_large_count_64bit()
+ if v:sizeoflong < 8
+ throw 'Skipped: only works with 64 bit long ints'
endif
new
@@ -159,6 +167,27 @@
bwipe!
endfunc
+func Test_very_large_count_block()
+ new
+ " total put-length (21474837 * 100) brings 32 bit int overflow
+ call setline(1, repeat('x', 100))
+ exe "norm \<C-V>99ly"
+ call assert_fails('norm 21474837p', 'E1240:')
+ bwipe!
+endfunc
+
+func Test_very_large_count_block_64bit()
+ if v:sizeoflong < 8
+ throw 'Skipped: only works with 64 bit long ints'
+ endif
+
+ new
+ call setline(1, 'x')
+ exe "norm \<C-V>y"
+ call assert_fails('norm 44444444444444p', 'E1240:')
+ bwipe!
+endfunc
+
func Test_put_above_first_line()
new
let @" = 'text'