mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
mruby-rational (int_lshift): check before actual left bit shift
This commit is contained in:
@@ -309,7 +309,7 @@ mrb_rational_new(mrb_state *mrb, mrb_int nume, mrb_int deno)
|
||||
static mrb_value
|
||||
int_lshift(mrb_state *mrb, mrb_value v, mrb_int n)
|
||||
{
|
||||
if (mrb_integer_p(v)) {
|
||||
if (mrb_integer_p(v) && n < (mrb_int)sizeof(long) * CHAR_BIT) {
|
||||
mrb_float f = (mrb_float)mrb_integer(v);
|
||||
f *= 1L<<n;
|
||||
if (mrb_int_fit_p(f, mrb_float))
|
||||
|
||||
Reference in New Issue
Block a user