summaryrefslogtreecommitdiffhomepage
path: root/src/string.c
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2015-12-16 14:49:43 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2015-12-16 14:49:43 +0900
commitf54a98ff156995926cb22a6d1fadddf18beff8d8 (patch)
tree308f2d422a53294ab3501419d2f52592473e06f5 /src/string.c
parentd18c55fca75c0f824cc3d85f5bb795efd41319f8 (diff)
downloadmruby-f54a98ff156995926cb22a6d1fadddf18beff8d8.tar.gz
mruby-f54a98ff156995926cb22a6d1fadddf18beff8d8.zip
mrb_str_len_to_inum(): fixed a bug with MRB_INT_MIN conversion; fix #3048
Diffstat (limited to 'src/string.c')
-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));
}