summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-complex
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2021-03-24 10:41:14 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2021-03-24 10:52:31 +0900
commit98799aa6b8cff160c510046b374ebec76fd6692c (patch)
tree27977281b50fc9f77fcbbcca53bd82797eceab0c /mrbgems/mruby-complex
parent3deb62d653e23b175e0c7688976f8af776808980 (diff)
downloadmruby-98799aa6b8cff160c510046b374ebec76fd6692c.tar.gz
mruby-98799aa6b8cff160c510046b374ebec76fd6692c.zip
Fix infinite recursive call bugs in integer division.
Diffstat (limited to 'mrbgems/mruby-complex')
-rw-r--r--mrbgems/mruby-complex/src/complex.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/mrbgems/mruby-complex/src/complex.c b/mrbgems/mruby-complex/src/complex.c
index b4e3499cf..11ca2bb95 100644
--- a/mrbgems/mruby-complex/src/complex.c
+++ b/mrbgems/mruby-complex/src/complex.c
@@ -304,6 +304,7 @@ int_div(mrb_state *mrb, mrb_value x)
}
switch (mrb_type(y)) {
case MRB_TT_COMPLEX:
+ x = complex_new(mrb, (mrb_float)a, 0);
return mrb_funcall_id(mrb, x, MRB_OPSYM(div), 1, y);
default:
return mrb_float_value(mrb, (mrb_float)a * mrb_to_flo(mrb, y));
@@ -323,6 +324,7 @@ int_quo(mrb_state *mrb, mrb_value x)
switch (mrb_type(y)) {
case MRB_TT_COMPLEX:
+ x = complex_new(mrb, (mrb_float)a, 0);
return mrb_funcall_id(mrb, x, MRB_OPSYM(div), 1, y);
default:
return mrb_float_value(mrb, (mrb_float)a * mrb_to_flo(mrb, y));