summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-11-15 11:43:50 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-11-15 11:43:50 +0000
commit8ff17ef26936f3bc4f0fec430fe4cdb56f069a33 (patch)
treedd6583b5061a7bc5e7adbfb8afd495863dabb584 /util.c
parent856e1f17f1846a2ad077aa7b0da6a2b8399fd7b7 (diff)
merges r29187 and r29239 from trunk into ruby_1_9_2, but does not raise
an error. just warning. -- * util.c (ruby_strtod): reject Float('0x0.'). [ruby-dev:42239] Bug #3820 -- * util.c (ruby_strtod): check there is at least 1 digit after "0x" before ".". [ruby-dev:42183] #3790 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@29795 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'util.c')
-rw-r--r--util.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/util.c b/util.c
index 1c0d8d6c7b..26f46baf00 100644
--- a/util.c
+++ b/util.c
@@ -2120,7 +2120,11 @@ break2:
static const char hexdigit[] = "0123456789abcdef0123456789ABCDEF";
s0 = ++s;
adj = 0;
+ aadj = -1;
+ if (!s[1]) {
+ rb_warn("malformed value for Float(): %s. Ruby 1.9.3 for later will raise an ArgumentError for the value.", s00);
+ }
while (*++s && (s1 = strchr(hexdigit, *s))) {
adj *= 16;
adj += (s1 - hexdigit) & 15;
@@ -2151,6 +2155,9 @@ break2:
dval(rv) = ldexp(adj, nd * dsign);
}
else {
+ if (aadj != -1) {
+ rb_warn("malformed value for Float(): %s. Ruby 1.9.3 for later will raise an ArgumentError for the value.", s00);
+ }
dval(rv) = adj;
}
goto ret;