summaryrefslogtreecommitdiff
path: root/vm.c
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-08-10 16:31:18 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-08-10 16:31:18 +0000
commite49c2e3569ebf5a1304483efca4c92c143a3e321 (patch)
treee4286f9d2b8f682645c2367e0c2f105eb251692c /vm.c
parent00d499992b74a91e8dc539c9076d7a8e9e078296 (diff)
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
Diffstat (limited to 'vm.c')
-rw-r--r--vm.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/vm.c b/vm.c
index 18811f1196..4ed901659c 100644
--- a/vm.c
+++ b/vm.c
@@ -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