mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
mrb_str_len_to_inum(): fixed a bug with MRB_INT_MIN conversion; fix #3048
This commit is contained in:
+1
-1
@@ -2170,7 +2170,7 @@ mrb_str_len_to_inum(mrb_state *mrb, const char *str, size_t len, int base, int b
|
||||
}
|
||||
n *= base;
|
||||
n += c;
|
||||
if (n > MRB_INT_MAX) {
|
||||
if (n > (int64_t)MRB_INT_MAX + (sign ? 0 : 1)) {
|
||||
mrb_raisef(mrb, E_ARGUMENT_ERROR, "string (%S) too big for integer",
|
||||
mrb_str_new(mrb, str, pend-str));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user