Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix divide-by-zero vulnerability in scroll_cursor_bot. #12540

Closed

Conversation

fullwaywang
Copy link

Fix #12528

@brammool
Copy link
Contributor

Please fix test_codestyle (move the "{" to the next line).

In the test, I wonder why you need to disable "wait_for_ruler"? It makes the test less reliable.
In that same place, why use 19 rows? Can't we use something smaller, e.g. 10 rows?

@fullwaywang
Copy link
Author

Hi, code style has been fixed :)

As for the wait_for_ruler option, I just kept it as same as the test for the fix of CVE-2023-0512. I did made an experiment, though, that without disabling wait_for_ruler, the single test would take 5 secs and fail. Not sure whether this is because vsplit is on or -g -O0 is configured in my experimental environment. After disabling it the test passes fine.

As for the 19 rows, well, it is an experimental value. In this specific, I need to ensure the curwin width is smaller than the line-number column width, so I put more than 10 empty lines there, and it worked.

@codecov
Copy link

codecov bot commented Jun 24, 2023

Codecov Report

Merging #12540 (e6db8a9) into master (166cd7b) will increase coverage by 0.01%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master   #12540      +/-   ##
==========================================
+ Coverage   82.07%   82.09%   +0.01%     
==========================================
  Files         160      160              
  Lines      193641   193651      +10     
  Branches    43480    43482       +2     
==========================================
+ Hits       158938   158983      +45     
+ Misses      21859    21833      -26     
+ Partials    12844    12835       -9     
Flag Coverage Δ
huge-clang-none 82.72% <100.00%> (-0.02%) ⬇️
linux 82.72% <100.00%> (-0.02%) ⬇️
mingw-x64-HUGE 76.61% <0.00%> (+<0.01%) ⬆️
mingw-x86-HUGE 77.06% <0.00%> (+<0.01%) ⬆️
windows 78.19% <0.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/move.c 92.55% <100.00%> (+<0.01%) ⬆️

... and 20 files with indirect coverage changes

@brammool brammool closed this in 8154e64 Jun 24, 2023
zeertzjq added a commit to zeertzjq/neovim that referenced this pull request Jun 27, 2023
… set

Problem:    Divide by zero when scrolling with 'smoothscroll' set.
Solution:   Avoid using a negative width. (closes vim/vim#12540, closes vim/vim#12528)

vim/vim@8154e64

Co-authored-by: fullwaywang <fullwaywang@tencent.com>
zeertzjq added a commit to zeertzjq/neovim that referenced this pull request Jun 27, 2023
… set

Problem:    Divide by zero when scrolling with 'smoothscroll' set.
Solution:   Avoid using a negative width. (closes vim/vim#12540, closes vim/vim#12528)

vim/vim@8154e64

Co-authored-by: fullwaywang <fullwaywang@tencent.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Divide-by-zero vulnerability in function scroll_cursor_bot
2 participants