mirror of
https://github.com/neovim/neovim.git
synced 2025-10-07 10:26:31 +00:00
vim-patch:8.1.1411: fix divide by zero #10073
Problem: Coverity warns for divide by zero.
Solution: Make sure width is larger than zero.
7833dab73c
This commit is contained in:

committed by
Justin M. Keyes

parent
c423ec65dc
commit
f8f63393c1
@@ -1095,8 +1095,9 @@ int win_lbr_chartabsize(win_T *wp, char_u *line, char_u *s, colnr_T col, int *he
|
|||||||
int width = (colnr_T)wp->w_width_inner - sbrlen - numberwidth;
|
int width = (colnr_T)wp->w_width_inner - sbrlen - numberwidth;
|
||||||
int prev_width = col ? ((colnr_T)wp->w_width_inner - (sbrlen + col))
|
int prev_width = col ? ((colnr_T)wp->w_width_inner - (sbrlen + col))
|
||||||
: 0;
|
: 0;
|
||||||
if (width == 0) {
|
|
||||||
width = (colnr_T)wp->w_width_inner;
|
if (width <= 0) {
|
||||||
|
width = 1;
|
||||||
}
|
}
|
||||||
added += ((size - prev_width) / width) * vim_strsize(p_sbr);
|
added += ((size - prev_width) / width) * vim_strsize(p_sbr);
|
||||||
if ((size - prev_width) % width) {
|
if ((size - prev_width) % width) {
|
||||||
|
Reference in New Issue
Block a user