summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorSyohei YOSHIDA <[email protected]>2016-01-14 11:07:07 +0900
committerSyohei YOSHIDA <[email protected]>2016-01-14 11:07:07 +0900
commit787685a0b9d26cc916d08ecbd876cdcd10ebdadb (patch)
tree9f4e73dafa73f4f9f36a3ae6cbb5526caf0461ec
parent2a661ac612c233045196fb11cb79e6e374a1680e (diff)
downloadmruby-787685a0b9d26cc916d08ecbd876cdcd10ebdadb.tar.gz
mruby-787685a0b9d26cc916d08ecbd876cdcd10ebdadb.zip
Fix all zero string case
-rw-r--r--src/string.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/string.c b/src/string.c
index a3f337d4b..2b01cc3a5 100644
--- a/src/string.c
+++ b/src/string.c
@@ -2153,6 +2153,8 @@ mrb_str_len_to_inum(mrb_state *mrb, const char *str, size_t len, int base, int b
break;
}
}
+ if (*(p - 1) == '0')
+ p--;
}
if (p == pend) {
if (badcheck) goto bad;