Mercurial > vim
comparison src/testdir/test_scroll_opt.vim @ 33774:f2dd85a2bfc0 v9.0.2107
patch 9.0.2107: [security]: FPE in adjust_plines_for_skipcol
Commit: https://github.com/vim/vim/commit/cb0b99f0672d8446585d26e998343dceca17d1ce
Author: Christian Brabandt <cb@256bit.org>
Date: Tue Nov 14 20:05:59 2023 +0100
patch 9.0.2107: [security]: FPE in adjust_plines_for_skipcol
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>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Thu, 16 Nov 2023 22:15:08 +0100 |
parents | 6e4bf51ec635 |
children | 8f65cb02af21 |
comparison
equal
deleted
inserted
replaced
33773:087539ab4b70 | 33774:f2dd85a2bfc0 |
---|---|
924 call VerifyScreenDump(buf, 'Test_smoothscroll_cursor_top', {}) | 924 call VerifyScreenDump(buf, 'Test_smoothscroll_cursor_top', {}) |
925 | 925 |
926 call StopVimInTerminal(buf) | 926 call StopVimInTerminal(buf) |
927 endfunc | 927 endfunc |
928 | 928 |
929 " Division by zero, shouldn't crash | |
930 func Test_smoothscroll_crash() | |
931 CheckScreendump | |
932 | |
933 let lines =<< trim END | |
934 20 new | |
935 vsp | |
936 put =repeat('aaaa', 20) | |
937 set nu fdc=1 smoothscroll cpo+=n | |
938 vert resize 0 | |
939 exe "norm! 0\<c-e>" | |
940 END | |
941 call writefile(lines, 'XSmoothScrollCrash', 'D') | |
942 let buf = RunVimInTerminal('-u NONE -S XSmoothScrollCrash', #{rows: 12, cols:40}) | |
943 call term_sendkeys(buf, "2\<C-E>\<C-L>") | |
944 | |
945 call StopVimInTerminal(buf) | |
946 endfunc | |
947 | |
929 " vim: shiftwidth=2 sts=2 expandtab | 948 " vim: shiftwidth=2 sts=2 expandtab |