summaryrefslogtreecommitdiff
path: root/vm_insnhelper.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-10-19 05:26:35 (GMT)
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-10-19 05:26:35 (GMT)
commit2d4a268cd36c753e80320558699071581d816f4b (patch)
tree2a39f3c2019f97e17c20a9706b0a375fcaa863ba /vm_insnhelper.c
parent00c9a6188bb457989e4cd842e7317c14df6d9a7a (diff)
check before access.
* vm_insnhelper.c (vm_push_frame): validate prev_frame because prev_frame can be the end of frame. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65162 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_insnhelper.c')
-rw-r--r--vm_insnhelper.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index de7cfcd..3f09991 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -271,9 +271,10 @@ vm_push_frame(rb_execution_context_t *ec,
}
{
rb_control_frame_t *prev_cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp);
- int cur_ruby_frame = VM_FRAME_RUBYFRAME_P(cfp);
- int pre_ruby_frame = VM_FRAME_RUBYFRAME_P(prev_cfp);
if (RUBY_VM_END_CONTROL_FRAME(ec) != prev_cfp) {
+ int cur_ruby_frame = VM_FRAME_RUBYFRAME_P(cfp);
+ int pre_ruby_frame = VM_FRAME_RUBYFRAME_P(prev_cfp);
+
pre_ruby_frame ? (cur_ruby_frame ? RB_DEBUG_COUNTER_INC(frame_R2R) :
RB_DEBUG_COUNTER_INC(frame_R2C)):
(cur_ruby_frame ? RB_DEBUG_COUNTER_INC(frame_C2R) :