diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2019-05-28 06:15:38 -0400 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2019-05-28 12:15:38 +0200 |
commit | f8f63393c12da88799cb480086922431de60ca0a (patch) | |
tree | bb7f73c1d26eefcfdff0b5326b308530679498e4 | |
parent | c423ec65dcda1b579a455c911fcf1857a1167809 (diff) | |
download | rneovim-f8f63393c12da88799cb480086922431de60ca0a.tar.gz rneovim-f8f63393c12da88799cb480086922431de60ca0a.tar.bz2 rneovim-f8f63393c12da88799cb480086922431de60ca0a.zip |
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.
https://github.com/vim/vim/commit/7833dab73c658e65f38553af89fd60c57a11ef49
-rw-r--r-- | src/nvim/charset.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/nvim/charset.c b/src/nvim/charset.c index b155b3861f..9060a0de82 100644 --- a/src/nvim/charset.c +++ b/src/nvim/charset.c @@ -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 prev_width = col ? ((colnr_T)wp->w_width_inner - (sbrlen + col)) : 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); if ((size - prev_width) % width) { |