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)
e21c1580b7
This commit is contained in:
Jan Edmund Lazo
2019-07-28 16:54:06 -04:00
parent 98d389ce55
commit b457a58e34
3 changed files with 73 additions and 20 deletions

View File

@@ -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;