summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-01-28 02:25:35 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-01-28 02:25:35 +0000
commitbe007d6eae988b657f639446ba6ff2bf0ddefa72 (patch)
treed594be6a7b995b42e8739707d5b44ce7317b164d
parent4676e643aae73a39e8ecf848c8c63a4be99e85a6 (diff)
merges r30641 from trunk into ruby_1_9_2.
-- * error.c (rb_invalid_str): prevent intermediate variable from GC. [ruby-core:34820] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@30692 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--error.c2
-rw-r--r--test/ruby/test_float.rb12
-rw-r--r--version.h2
4 files changed, 19 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 9ae2ecdc82..c2faa38e5e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Mon Jan 24 21:04:45 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * error.c (rb_invalid_str): prevent intermediate variable from GC.
+ [ruby-core:34820]
+
Sat Jan 22 11:21:40 2011 Aaron Patterson <aaron@tenderlovemaking.com>
* ext/psych/parser.c (parse): fixing off-by-one error on line numbers
diff --git a/error.c b/error.c
index 350cb018a6..c519d0c4ca 100644
--- a/error.c
+++ b/error.c
@@ -927,7 +927,7 @@ nometh_err_args(VALUE self)
void
rb_invalid_str(const char *str, const char *type)
{
- VALUE s = rb_str_inspect(rb_str_new2(str));
+ volatile VALUE s = rb_str_inspect(rb_str_new2(str));
rb_raise(rb_eArgError, "invalid value for %s: %s", type, RSTRING_PTR(s));
}
diff --git a/test/ruby/test_float.rb b/test/ruby/test_float.rb
index fffa96e313..b465814140 100644
--- a/test/ruby/test_float.rb
+++ b/test/ruby/test_float.rb
@@ -442,6 +442,18 @@ class TestFloat < Test::Unit::TestCase
assert(Float(o).nan?)
end
+ def test_invalid_str
+ bug4310 = '[ruby-core:34820]'
+ assert_raise(ArgumentError, bug4310) {
+ stress, GC.stress = GC.stress, true
+ begin
+ Float('a'*10000)
+ ensure
+ GC.stress = stress
+ end
+ }
+ end
+
def test_num2dbl
assert_raise(TypeError) do
1.0.step(2.0, "0.5") {}
diff --git a/version.h b/version.h
index 6561988c3b..1779949812 100644
--- a/version.h
+++ b/version.h
@@ -1,5 +1,5 @@
#define RUBY_VERSION "1.9.2"
-#define RUBY_PATCHLEVEL 169
+#define RUBY_PATCHLEVEL 170
#define RUBY_VERSION_MAJOR 1
#define RUBY_VERSION_MINOR 9
#define RUBY_VERSION_TEENY 1