* 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/trunk@29187 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
0ed5aee000
commit
a69423beb8
@ -1,3 +1,8 @@
|
|||||||
|
Mon Sep 6 09:47:24 2010 NARUSE, Yui <naruse@ruby-lang.org>
|
||||||
|
|
||||||
|
* util.c (ruby_strtod): check there is at least 1 digit after
|
||||||
|
"0x" before ".". [ruby-dev:42183] #3790
|
||||||
|
|
||||||
Mon Sep 6 09:44:50 2010 NARUSE, Yui <naruse@ruby-lang.org>
|
Mon Sep 6 09:44:50 2010 NARUSE, Yui <naruse@ruby-lang.org>
|
||||||
|
|
||||||
* util.c (ruby_strtod): check integr overflow.
|
* util.c (ruby_strtod): check integr overflow.
|
||||||
|
@ -447,6 +447,7 @@ class TestFloat < Test::Unit::TestCase
|
|||||||
assert(!Float(([1] * 10000).join("_")).infinite?) # is it really OK?
|
assert(!Float(([1] * 10000).join("_")).infinite?) # is it really OK?
|
||||||
assert_raise(ArgumentError) { Float("1.0\x001") }
|
assert_raise(ArgumentError) { Float("1.0\x001") }
|
||||||
assert_equal(15.9375, Float('0xf.fp0'))
|
assert_equal(15.9375, Float('0xf.fp0'))
|
||||||
|
assert_raise(ArgumentError) { Float('0x') }
|
||||||
assert_raise(ArgumentError) { Float('0xf.fp') }
|
assert_raise(ArgumentError) { Float('0xf.fp') }
|
||||||
assert_equal(Float::INFINITY, Float('0xf.fp1000000000000000'))
|
assert_equal(Float::INFINITY, Float('0xf.fp1000000000000000'))
|
||||||
assert_equal(1, suppress_warning {Float("1e10_00")}.infinite?)
|
assert_equal(1, suppress_warning {Float("1e10_00")}.infinite?)
|
||||||
|
5
util.c
5
util.c
@ -2123,10 +2123,11 @@ break2:
|
|||||||
s0 = ++s;
|
s0 = ++s;
|
||||||
adj = 0;
|
adj = 0;
|
||||||
|
|
||||||
while (*++s && (s1 = strchr(hexdigit, *s))) {
|
if (!*++s || !(s1 = strchr(hexdigit, *s))) goto ret0;
|
||||||
|
do {
|
||||||
adj *= 16;
|
adj *= 16;
|
||||||
adj += (s1 - hexdigit) & 15;
|
adj += (s1 - hexdigit) & 15;
|
||||||
}
|
} while (*++s && (s1 = strchr(hexdigit, *s)));
|
||||||
|
|
||||||
if (*s == '.') {
|
if (*s == '.') {
|
||||||
aadj = 1.;
|
aadj = 1.;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user