mrb_str_len_to_inum(): fixed a bug with MRB_INT_MIN conversion; fix #3048

This commit is contained in:
Yukihiro "Matz" Matsumoto
2015-12-16 14:49:43 +09:00
parent d18c55fca7
commit f54a98ff15
+1 -1
View File
@@ -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));
}