1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

merge revision(s) 51263,51264: [Backport #11352]

* vm.c (m_core_hash_merge_ptr): copy the arguments to the machine
	  stack before rewinding the control frame pointer and leaving the
	  arguments outside valid region of the value stack.
	  [ruby-core:69969] [Bug #11352]

	* vm.c (REWIND_CFP): keep the arguments region inside the valid
	  value stack.  [ruby-core:69969] [Bug #11352]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@51521 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nagachika 2015-08-10 16:31:18 +00:00
parent 00d499992b
commit e49c2e3569
4 changed files with 31 additions and 2 deletions

View file

@ -1,3 +1,13 @@
Tue Aug 11 01:21:49 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
* vm.c (m_core_hash_merge_ptr): copy the arguments to the machine
stack before rewinding the control frame pointer and leaving the
arguments outside valid region of the value stack.
[ruby-core:69969] [Bug #11352]
* vm.c (REWIND_CFP): keep the arguments region inside the valid
value stack. [ruby-core:69969] [Bug #11352]
Tue Aug 11 01:11:02 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
* string.c (rb_str_reverse): reversed string is not a substring,

View file

@ -192,7 +192,9 @@ class TestRubyLiteral < Test::Unit::TestCase
assert_normal_exit %q{GC.disable=true; x = nil; raise if eval("[#{(1..1_000_000).to_a.join(", ")}]").size != 1_000_000}, "", timeout: 300, child_env: %[--disable-gems]
assert_normal_exit %q{GC.disable=true; x = nil; raise if eval("{#{(1..1_000_000).map{|n| "#{n} => x"}.join(', ')}}").size != 1_000_000}, "", timeout: 300, child_env: %[--disable-gems]
assert_normal_exit %q{GC.disable=true; x = nil; raise if eval("{#{(1..1_000_000).map{|n| "#{n} => #{n}"}.join(', ')}}").size != 1_000_000}, "", timeout: 300, child_env: %[--disable-gems]
end
def test_big_hash_literal
bug7466 = '[ruby-dev:46658]'
h = {
0xFE042 => 0xE5CD,
@ -327,6 +329,19 @@ class TestRubyLiteral < Test::Unit::TestCase
}
k = h.keys
assert_equal([129, 0xFE331], [k.size, k.last], bug7466)
code = [
"h = {",
(1..128).map {|i| "#{i} => 0,"},
(129..140).map {|i| "#{i} => [],"},
"}",
].join
assert_separately([], <<-"end;")
GC.stress = true
#{code}
GC.stress = false
assert_equal(140, h.size)
end;
end
def test_range

View file

@ -1,6 +1,6 @@
#define RUBY_VERSION "2.2.3"
#define RUBY_RELEASE_DATE "2015-08-11"
#define RUBY_PATCHLEVEL 153
#define RUBY_PATCHLEVEL 154
#define RUBY_RELEASE_YEAR 2015
#define RUBY_RELEASE_MONTH 8

6
vm.c
View file

@ -2267,7 +2267,11 @@ vm_define_method(rb_thread_t *th, VALUE obj, ID id, VALUE iseqval,
#define REWIND_CFP(expr) do { \
rb_thread_t *th__ = GET_THREAD(); \
th__->cfp++; expr; th__->cfp--; \
VALUE *const curr_sp = (th__->cfp++)->sp; \
VALUE *const saved_sp = th__->cfp->sp; \
th__->cfp->sp = curr_sp; \
expr; \
(th__->cfp--)->sp = saved_sp; \
} while (0)
static VALUE