summaryrefslogtreecommitdiffstats
path: root/src/testdir
diff options
context:
space:
mode:
authorChristian Brabandt <cb@256bit.org>2023-11-14 20:05:59 +0100
committerChristian Brabandt <cb@256bit.org>2023-11-16 22:04:37 +0100
commitcb0b99f0672d8446585d26e998343dceca17d1ce (patch)
tree3cba6fe840cd98102776409e60a69ae0a24246aa /src/testdir
parent25aabc2b8ee1e19ced6f4da9d866cf9378fc4c5a (diff)
patch 9.0.2107: [security]: FPE in adjust_plines_for_skipcolv9.0.2107
Problem: [security]: FPE in adjust_plines_for_skipcol Solution: don't divide by zero, return zero Prevent a floating point exception when calculating w_skipcol (which can happen with a small window when the number option is set and cpo+=n). Add a test to verify Signed-off-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'src/testdir')
-rw-r--r--src/testdir/test_scroll_opt.vim19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/testdir/test_scroll_opt.vim b/src/testdir/test_scroll_opt.vim
index d5d08a24c2..342d382c20 100644
--- a/src/testdir/test_scroll_opt.vim
+++ b/src/testdir/test_scroll_opt.vim
@@ -926,4 +926,23 @@ func Test_smoothscroll_cursor_top()
call StopVimInTerminal(buf)
endfunc
+" Division by zero, shouldn't crash
+func Test_smoothscroll_crash()
+ CheckScreendump
+
+ let lines =<< trim END
+ 20 new
+ vsp
+ put =repeat('aaaa', 20)
+ set nu fdc=1 smoothscroll cpo+=n
+ vert resize 0
+ exe "norm! 0\<c-e>"
+ END
+ call writefile(lines, 'XSmoothScrollCrash', 'D')
+ let buf = RunVimInTerminal('-u NONE -S XSmoothScrollCrash', #{rows: 12, cols:40})
+ call term_sendkeys(buf, "2\<C-E>\<C-L>")
+
+ call StopVimInTerminal(buf)
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab