From d18c55fca75c0f824cc3d85f5bb795efd41319f8 Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Wed, 16 Dec 2015 14:47:49 +0900 Subject: mrb_str_len_to_inum(): fixed a bug with underscores in digits; fix #3049 --- src/string.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/string.c b/src/string.c index eda4c3fb8..3fbea4c99 100644 --- a/src/string.c +++ b/src/string.c @@ -2145,29 +2145,24 @@ mrb_str_len_to_inum(mrb_state *mrb, const char *str, size_t len, int base, int b } } } - c = *p; - if (badcheck && c == '\0') { - goto bad; - } - c = conv_digit(c); - if (c < 0 || c >= base) { + if (p == pend) { if (badcheck) goto bad; return mrb_fixnum_value(0); } - for ( ;p= base) { -- cgit v1.2.3