Skip to content

Commit

Permalink
mrb_str_len_to_inum(): fixed a bug with MRB_INT_MIN conversion; fix #…
Browse files Browse the repository at this point in the history
  • Loading branch information
matz committed Dec 16, 2015
1 parent d18c55f commit f54a98f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/string.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down

0 comments on commit f54a98f

Please sign in to comment.