ruby-changes:52948
From: ko1 <ko1@a...>
Date: Fri, 19 Oct 2018 14:26:39 +0900 (JST)
Subject: [ruby-changes:52948] ko1:r65162 (trunk): check before access.
ko1 2018-10-19 14:26:35 +0900 (Fri, 19 Oct 2018) New Revision: 65162 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=65162 Log: check before access. * vm_insnhelper.c (vm_push_frame): validate prev_frame because prev_frame can be the end of frame. Modified files: trunk/vm_insnhelper.c Index: vm_insnhelper.c =================================================================== --- vm_insnhelper.c (revision 65161) +++ vm_insnhelper.c (revision 65162) @@ -271,9 +271,10 @@ vm_push_frame(rb_execution_context_t *ec https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L271 } { 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) : -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/