From 0fee6e1ee98725e117e04b33440af395ea8e0491 Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Sat, 28 Apr 2018 15:15:28 +0900 Subject: Fix broken support of `MRB_WITHOUT_FLOAT`; fix #4015 --- src/string.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/string.c') diff --git a/src/string.c b/src/string.c index 8ebd11b6c..e4bfd034c 100644 --- a/src/string.c +++ b/src/string.c @@ -2167,10 +2167,13 @@ mrb_str_len_to_inum(mrb_state *mrb, const char *str, mrb_int len, mrb_int base, n *= base; n += c; if (n > (uint64_t)MRB_INT_MAX + (sign ? 0 : 1)) { +#ifndef MRB_WITHOUT_FLOAT if (base == 10) { return mrb_float_value(mrb, mrb_str_to_dbl(mrb, mrb_str_new(mrb, str, len), badcheck)); } - else { + else +#endif + { mrb_raisef(mrb, E_ARGUMENT_ERROR, "string (%S) too big for integer", mrb_str_new(mrb, str, pend-str)); } -- cgit v1.2.3