From 9e91e32c754a8369dbf659d50cd2bf199250a25f Mon Sep 17 00:00:00 2001 From: "hyunghwan.chung" Date: Sun, 23 Dec 2018 16:43:19 +0000 Subject: [PATCH] made div-by-zero a soft failure in pf_integer_div --- moo/lib/exec.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/moo/lib/exec.c b/moo/lib/exec.c index a808a46..9b2c5fe 100644 --- a/moo/lib/exec.c +++ b/moo/lib/exec.c @@ -2880,8 +2880,7 @@ static moo_pfrc_t pf_integer_div (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs) arg = MOO_STACK_GETARG(moo, nargs, 0); quo = moo_divints(moo, rcv, arg, 0, MOO_NULL); - if (!quo) return (moo->errnum == MOO_EINVAL? MOO_PF_FAILURE: MOO_PF_HARD_FAILURE); -/* TODO: MOO_EDIVBY0 soft or hard failure? */ + if (!quo) return (moo->errnum == MOO_EINVAL || moo->errnum == MOO_EDIVBY0? MOO_PF_FAILURE: MOO_PF_HARD_FAILURE); MOO_STACK_SETRET (moo, nargs, quo); return MOO_PF_SUCCESS;