aboutsummaryrefslogtreecommitdiffstats
path: root/util.c
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-10-20 01:48:24 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-10-20 01:48:24 +0000
commit05ba0b1dd52193c57c149115839f81e929b11626 (patch)
treed9b34b34141eebe54a0c09a34be4a17d13a307ed /util.c
parent9e14a3fa1d851525374a4bb0b3d1100f2e88a297 (diff)
downloadruby-05ba0b1dd52193c57c149115839f81e929b11626.tar.gz
* util.c (ruby_strtod): reject 0x1.p+0. [ruby-dev:42432] #3966
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29539 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'util.c')
-rw-r--r--util.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/util.c b/util.c
index 6cd2d2049e..53a4e9f89e 100644
--- a/util.c
+++ b/util.c
@@ -2132,10 +2132,11 @@ break2:
if (*s == '.') {
aadj = 1.;
- while (*++s && (s1 = strchr(hexdigit, *s))) {
+ if (!*++s || !(s1 = strchr(hexdigit, *s))) goto ret0;
+ do {
aadj /= 16;
adj += aadj * ((s1 - hexdigit) & 15);
- }
+ } while (*++s && (s1 = strchr(hexdigit, *s)));
}
if (*s == 'P' || *s == 'p') {