summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'util.c')
-rw-r--r--util.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/util.c b/util.c
index 5eaee4cb0b..953927d145 100644
--- a/util.c
+++ b/util.c
@@ -848,9 +848,15 @@ ruby_strtod(
}
expSign = FALSE;
}
- while (ISDIGIT(*p)) {
- exp = exp * 10 + (*p - '0');
- p += 1;
+ if (ISDIGIT(*p)) {
+ do {
+ exp = exp * 10 + (*p - '0');
+ p += 1;
+ }
+ while (ISDIGIT(*p));
+ }
+ else {
+ p = pExp;
}
}
if (expSign) {