diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-11-22 03:51:11 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-11-22 03:51:11 +0000 |
commit | 60c29bbbf6574e0e947c56e71c3c3ca11620ee15 (patch) | |
tree | 00b520a8985d7437d3b567dd7dd14b70d89747a6 | |
parent | b8a95c0f4a42afea2948e76d1ad23acea42be5bd (diff) |
merge revision(s) 43775:
* util.c (ruby_strtod): ignore too long fraction part, which does not
affect the result.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@43776 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | test/ruby/test_float.rb | 12 | ||||
-rw-r--r-- | util.c | 14 | ||||
-rw-r--r-- | version.h | 6 |
4 files changed, 32 insertions, 5 deletions
@@ -1,3 +1,8 @@ +Fri Nov 22 12:44:56 2013 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * util.c (ruby_strtod): ignore too long fraction part, which does not + affect the result. + Fri Nov 1 00:08:21 2013 Martin Bosslet <Martin.Bosslet@gmail.com> * test/openssl/test_pkey_ec.rb: Skip tests for "Oakley" curves as diff --git a/test/ruby/test_float.rb b/test/ruby/test_float.rb index d2cee75433..301aeecf0f 100644 --- a/test/ruby/test_float.rb +++ b/test/ruby/test_float.rb @@ -519,4 +519,16 @@ class TestFloat < Test::Unit::TestCase sleep(0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1) end end + + def test_long_string + assert_normal_exit(<<-'end;') + assert_in_epsilon(10.0, ("1."+"1"*300000).to_f*9) + end; + end + + def test_long_string + assert_normal_exit(<<-'end;') + assert_in_epsilon(10.0, ("1."+"1"*300000).to_f*9) + end; + end end @@ -674,6 +674,11 @@ extern void *MALLOC(size_t); #else #define MALLOC malloc #endif +#ifdef FREE +extern void FREE(void*); +#else +#define FREE free +#endif #ifndef Omit_Private_Memory #ifndef PRIVATE_MEM @@ -964,7 +969,7 @@ Balloc(int k) #endif ACQUIRE_DTOA_LOCK(0); - if ((rv = freelist[k]) != 0) { + if (k <= Kmax && (rv = freelist[k]) != 0) { freelist[k] = rv->next; } else { @@ -974,7 +979,7 @@ Balloc(int k) #else len = (sizeof(Bigint) + (x-1)*sizeof(ULong) + sizeof(double) - 1) /sizeof(double); - if (pmem_next - private_mem + len <= PRIVATE_mem) { + if (k <= Kmax && pmem_next - private_mem + len <= PRIVATE_mem) { rv = (Bigint*)pmem_next; pmem_next += len; } @@ -993,6 +998,10 @@ static void Bfree(Bigint *v) { if (v) { + if (v->k > Kmax) { + FREE(v); + return; + } ACQUIRE_DTOA_LOCK(0); v->next = freelist[v->k]; freelist[v->k] = v; @@ -2053,6 +2062,7 @@ break2: for (; c >= '0' && c <= '9'; c = *++s) { have_dig: nz++; + if (nf > DBL_DIG * 2) continue; if (c -= '0') { nf += nz; for (i = 1; i < nz; i++) @@ -1,10 +1,10 @@ #define RUBY_VERSION "1.9.3" -#define RUBY_PATCHLEVEL 482 +#define RUBY_PATCHLEVEL 483 -#define RUBY_RELEASE_DATE "2013-11-01" +#define RUBY_RELEASE_DATE "2013-11-22" #define RUBY_RELEASE_YEAR 2013 #define RUBY_RELEASE_MONTH 11 -#define RUBY_RELEASE_DAY 1 +#define RUBY_RELEASE_DAY 22 #include "ruby/version.h" |