[前][次][番号順一覧][スレッド一覧]

ruby-changes:25883

From: ko1 <ko1@a...>
Date: Wed, 28 Nov 2012 22:56:42 +0900 (JST)
Subject: [ruby-changes:25883] ko1:r37940 (trunk): * vm_insnhelper.c (vm_call_method): fix undefined behavior.

ko1	2012-11-28 22:56:29 +0900 (Wed, 28 Nov 2012)

  New Revision: 37940

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=37940

  Log:
    * vm_insnhelper.c (vm_call_method): fix undefined behavior.
      Should not access scope local variable from outer scope.

  Modified files:
    trunk/ChangeLog
    trunk/vm_insnhelper.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 37939)
+++ ChangeLog	(revision 37940)
@@ -1,3 +1,8 @@
+Wed Nov 28 22:54:21 2012  Koichi Sasada  <ko1@a...>
+
+	* vm_insnhelper.c (vm_call_method): fix undefined behavior.
+	  Should not access scope local variable from outer scope.
+
 Wed Nov 28 22:20:55 2012  Masaya Tarui  <tarui@r...>
 
 	* test/ruby/test_thread.rb (test_thread_status_in_trap): change test for
Index: vm_insnhelper.c
===================================================================
--- vm_insnhelper.c	(revision 37939)
+++ vm_insnhelper.c	(revision 37940)
@@ -1698,6 +1698,7 @@
 vm_call_method(rb_thread_t *th, rb_control_frame_t *cfp, rb_call_info_t *ci)
 {
     int enable_fastpath = 1;
+    rb_call_info_t ci_temp;
 
   start_method_dispatch:
     if (ci->me != 0) {
@@ -1735,8 +1736,8 @@
 	      }
 	      case VM_METHOD_TYPE_ZSUPER:{
 		VALUE klass = RCLASS_SUPER(ci->me->klass);
-		rb_call_info_t cie = *ci;
-		ci = &cie;
+		ci_temp = *ci;
+		ci = &ci_temp;
 
 		ci->me = rb_method_entry(klass, ci->mid, &ci->defined_class);
 

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]