diff options
author | Sean Dewar <seandewar@users.noreply.github.com> | 2022-02-16 22:19:06 +0000 |
---|---|---|
committer | Sean Dewar <seandewar@users.noreply.github.com> | 2022-02-17 14:45:22 +0000 |
commit | de8e2c61c1b273f57a5a2d85c474b4f12b1b8994 (patch) | |
tree | c137bd66072effd728b8c37157fea258231835a2 | |
parent | b149665689f84ee7297ab5ce8a8eb59b12611af1 (diff) | |
download | rneovim-de8e2c61c1b273f57a5a2d85c474b4f12b1b8994.tar.gz rneovim-de8e2c61c1b273f57a5a2d85c474b4f12b1b8994.tar.bz2 rneovim-de8e2c61c1b273f57a5a2d85c474b4f12b1b8994.zip |
vim-patch:8.2.3574: divide by zero
Problem: Divide by zero.
Solution: Don't check for overflow if multiplicand is zero.
https://github.com/vim/vim/commit/8a1962d1355096af55e84b1ea2f0baf5f1c5a5bc
-rw-r--r-- | src/nvim/ops.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/nvim/ops.c b/src/nvim/ops.c index 2218b079b0..8dc367d572 100644 --- a/src/nvim/ops.c +++ b/src/nvim/ops.c @@ -3434,8 +3434,9 @@ void do_put(int regname, yankreg_T *reg, int dir, long count, int flags) const long multlen = count * yanklen; totlen = (size_t)(int)multlen; - if (totlen != (size_t)multlen || (long)totlen / count != yanklen - || (long)totlen / yanklen != count) { + if (count != 0 && yanklen != 0 + && (totlen != (size_t)multlen || (long)totlen / count != yanklen + || (long)totlen / yanklen != count)) { emsg(_(e_resulting_text_too_long)); break; } else if (totlen > 0) { |