diff options
author | Yamakaky <yamakaky@gmail.com> | 2015-05-05 19:39:03 +0200 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2015-05-09 10:56:05 -0400 |
commit | 48bd94e98fdc2b119185a9928b128faa019c52e5 (patch) | |
tree | 6849ae8a71862adc7370777d0e95804f97d19d66 | |
parent | d9565353071234ac9d36927401e50d047cf95c6c (diff) | |
download | rneovim-48bd94e98fdc2b119185a9928b128faa019c52e5.tar.gz rneovim-48bd94e98fdc2b119185a9928b128faa019c52e5.tar.bz2 rneovim-48bd94e98fdc2b119185a9928b128faa019c52e5.zip |
vim-patch:7.4.606 #2594
Problem: May crash when using a small window.
Solution: Avoid dividing by zero. (Christian Brabandt)
https://github.com/vim/vim/commit/v7-4-606
-rw-r--r-- | src/nvim/normal.c | 4 | ||||
-rw-r--r-- | src/nvim/version.c | 2 |
2 files changed, 5 insertions, 1 deletions
diff --git a/src/nvim/normal.c b/src/nvim/normal.c index 676afe9e91..3cf3636e23 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -3399,6 +3399,10 @@ static bool nv_screengo(oparg_T *oap, int dir, long dist) width1 = curwin->w_width - col_off1; width2 = curwin->w_width - col_off2; + if (width2 == 0) { + width2 = 1; // Avoid divide by zero. + } + if (curwin->w_width != 0) { /* * Instead of sticking at the last character of the buffer line we diff --git a/src/nvim/version.c b/src/nvim/version.c index 841d8b4fe1..ce7a21a99a 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -177,7 +177,7 @@ static int included_patches[] = { //609, //608, //607, - //606, + 606, //605, //604, //603, |