8000 merge revision(s) 51263,51264: [Backport #11352] · github/ruby@59f1eaa · GitHub
[go: up one dir, main page]

Skip to content

Commit 59f1eaa

Browse files
committed
merge revision(s) 51263,51264: [Backport ruby#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 ruby#11352] * vm.c (REWIND_CFP): keep the arguments region inside the valid value stack. [ruby-core:69969] [Bug ruby#11352] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@51601 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent 51954bd commit 59f1eaa

File tree

4 files changed

+31
-2
lines changed

4 files changed

+31
-2
lines changed

ChangeLog

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
Mon Aug 17 16:46:28 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
2+
3+
* vm.c (m_core_hash_merge_ptr): copy the arguments to the machine
4+
stack before rewinding the control frame pointer and leaving the
5+
arguments outside valid region of the value stack.
6+
[ruby-core:69969] [Bug #11352]
7+
8+
* vm.c (REWIND_CFP): keep the arguments region inside the valid
9+
value stack. [ruby-core:69969] [Bug #11352]
10+
111
Mon Aug 17 16:44:01 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
212

313
* string.c (rb_str_reverse): reversed string is not a substring,

test/ruby/test_literal.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,9 @@ def test_big_array_and_hash_literal
193193
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]
194194
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]
195195
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]
196+
end
196197

198+
def test_big_hash_literal
197199
bug7466 = '[ruby-dev:46658]'
198200
h = {
199201
0xFE042 => 0xE5CD,
@@ -328,6 +330,19 @@ def test_big_array_and_hash_literal
328330
}
329331
k = h.keys
330332
assert_equal([129, 0xFE331], [k.size, k.last], bug7466)
333+
334+
code = [
335+
"h = {",
336+
(1..128).map {|i| "#{i} => 0,"},
337+
(129..140).map {|i| "#{i} => [],"},
338+
"}",
339+
].join
340+
assert_separately([], <<-"end;")
341+
GC.stress = true
342+
#{code}
343+
GC.stress = false
344+
assert_equal(140, h.size)
345+
end;
331346
end
332347

333348
def test_range

version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#define RUBY_VERSION "2.1.7"
22
#define RUBY_RELEASE_DATE "2015-08-17"
3-
#define RUBY_PATCHLEVEL 384
3+
#define RUBY_PATCHLEVEL 385
44

55
#define RUBY_RELEASE_YEAR 2015
66
#define RUBY_RELEASE_MONTH 8

vm.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2269,7 +2269,11 @@ vm_define_method(rb_thread_t *th, VALUE obj, ID id, VALUE iseqval,
22692269

22702270
#define REWIND_CFP(expr) do { \
22712271
rb_thread_t *th__ = GET_THREAD(); \
2272-
th__->cfp++; expr; th__->cfp--; \
2272+
VALUE *const curr_sp = (th__->cfp++)->sp; \
2273+
VALUE *const saved_sp = th__->cfp->sp; \
2274+
th__->cfp->sp = curr_sp; \
2275+
expr; \
2276+
(th__->cfp--)->sp = saved_sp; \
22732277
} while (0)
22742278

22752279
static VALUE

0 commit comments

Comments
 (0)
0