From b457a58e34d43d49a01dd93ec356099d232bd713 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sun, 28 Jul 2019 16:54:06 -0400 Subject: vim-patch:8.1.0990: floating point exception with "%= 0" and "/= 0" Problem: Floating point exception with "%= 0" and "/= 0". Solution: Avoid dividing by zero. (Dominique Pelle, closes vim/vim#4058) https://github.com/vim/vim/commit/e21c1580b7acb598a6e3c38565434fe5d0e2ad7a --- src/nvim/eval/executor.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/nvim/eval/executor.c') diff --git a/src/nvim/eval/executor.c b/src/nvim/eval/executor.c index e972c506dd..8cd21f8d62 100644 --- a/src/nvim/eval/executor.c +++ b/src/nvim/eval/executor.c @@ -74,8 +74,8 @@ int eexe_mod_op(typval_T *const tv1, const typval_T *const tv2, case '+': n += tv_get_number(tv2); break; case '-': n -= tv_get_number(tv2); break; case '*': n *= tv_get_number(tv2); break; - case '/': n /= tv_get_number(tv2); break; - case '%': n %= tv_get_number(tv2); break; + case '/': n = num_divide(n, tv_get_number(tv2)); break; + case '%': n = num_modulus(n, tv_get_number(tv2)); break; } tv_clear(tv1); tv1->v_type = VAR_NUMBER; -- cgit