0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 8.2.2376: Vim9: crash when dividing by zero in compiled code

Problem:    Vim9: crash when dividing by zero in compiled code using
            constants.
Solution:   Call num_divide() and num_modulus(). (closes #7704)
This commit is contained in:
Bram Moolenaar
2021-01-19 22:16:41 +01:00
parent 09fbedc8dc
commit e64f83cc6a
3 changed files with 8 additions and 2 deletions

View File

@@ -4300,9 +4300,11 @@ compile_expr6(char_u **arg, cctx_T *cctx, ppconst_T *ppconst)
{
case '*': res = tv1->vval.v_number * tv2->vval.v_number;
break;
case '/': res = tv1->vval.v_number / tv2->vval.v_number;
case '/': res = num_divide(tv1->vval.v_number,
tv2->vval.v_number);
break;
case '%': res = tv1->vval.v_number % tv2->vval.v_number;
case '%': res = num_modulus(tv1->vval.v_number,
tv2->vval.v_number);
break;
}
tv1->vval.v_number = res;