* util.c (ruby_scan_digits): fix the return length off-by-one
  error when the length is given and the last char is a digit.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50935 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2015-06-17 07:21:41 +00:00
Родитель aabe6b46a8
Коммит e521b916ec
1 изменённых файлов: 2 добавлений и 1 удалений

3
util.c
Просмотреть файл

@ -94,6 +94,7 @@ ruby_scan_digits(const char *str, ssize_t len, int base, size_t *retlen, int *ov
do {
int d = ruby_digit36_to_number_table[(unsigned char)*str++];
if (d == -1 || base <= d) {
--str;
break;
}
if (mul_overflow < ret)
@ -104,7 +105,7 @@ ruby_scan_digits(const char *str, ssize_t len, int base, size_t *retlen, int *ov
if (ret < x)
*overflow = 1;
} while (len < 0 || --len);
*retlen = (str-1) - start;
*retlen = str - start;
return ret;
}