summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/string.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/string.c b/src/string.c
index 3fbea4c99..2638fa04e 100644
--- a/src/string.c
+++ b/src/string.c
@@ -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));
}