diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2021-03-24 10:41:14 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2021-03-24 10:52:31 +0900 |
| commit | 98799aa6b8cff160c510046b374ebec76fd6692c (patch) | |
| tree | 27977281b50fc9f77fcbbcca53bd82797eceab0c /mrbgems/mruby-complex/src/complex.c | |
| parent | 3deb62d653e23b175e0c7688976f8af776808980 (diff) | |
| download | mruby-98799aa6b8cff160c510046b374ebec76fd6692c.tar.gz mruby-98799aa6b8cff160c510046b374ebec76fd6692c.zip | |
Fix infinite recursive call bugs in integer division.
Diffstat (limited to 'mrbgems/mruby-complex/src/complex.c')
| -rw-r--r-- | mrbgems/mruby-complex/src/complex.c | 2 |
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)); |
