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

ruby-changes:20964

From: ktsj <ko1@a...>
Date: Sat, 20 Aug 2011 13:26:29 +0900 (JST)
Subject: [ruby-changes:20964] ktsj:r33013 (trunk): * iseq.c (iseq_s_disasm): fix a bug that may cause SEGV.

ktsj	2011-08-20 13:26:20 +0900 (Sat, 20 Aug 2011)

  New Revision: 33013

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

  Log:
    * iseq.c (iseq_s_disasm): fix a bug that may cause SEGV.
    
    * test/ruby/test_method.rb (test_body): add a test for the above change.

  Modified files:
    trunk/ChangeLog
    trunk/iseq.c
    trunk/test/ruby/test_method.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 33012)
+++ ChangeLog	(revision 33013)
@@ -1,3 +1,9 @@
+Sat Aug 20 13:19:52 2011  Kazuki Tsujimoto  <kazuki@c...>
+
+	* iseq.c (iseq_s_disasm): fix a bug that may cause SEGV.
+
+	* test/ruby/test_method.rb (test_body): add a test for the above change.
+
 Sat Aug 20 10:43:24 2011  Nobuyoshi Nakada  <nobu@r...>
 
 	* ext/stringio/stringio.c (strio_read): return new string if nil
Index: iseq.c
===================================================================
--- iseq.c	(revision 33012)
+++ iseq.c	(revision 33013)
@@ -1030,9 +1030,9 @@
 	rb_proc_t *proc;
 	VALUE iseqval;
 	GetProcPtr(body, proc);
-	iseqval = proc->block.iseq->self;
-	if (RUBY_VM_NORMAL_ISEQ_P(iseqval)) {
-	    ret = rb_iseq_disasm(iseqval);
+	iseq = proc->block.iseq;
+	if (RUBY_VM_NORMAL_ISEQ_P(iseq)) {
+	    ret = rb_iseq_disasm(iseq->self);
 	}
     }
     else if ((iseq = rb_method_get_iseq(body)) != 0) {
Index: test/ruby/test_method.rb
===================================================================
--- test/ruby/test_method.rb	(revision 33012)
+++ test/ruby/test_method.rb	(revision 33013)
@@ -123,6 +123,7 @@
     def o.foo; end
     assert_nothing_raised { RubyVM::InstructionSequence.disasm(o.method(:foo)) }
     assert_nothing_raised { RubyVM::InstructionSequence.disasm("x".method(:upcase)) }
+    assert_nothing_raised { RubyVM::InstructionSequence.disasm(method(:to_s).to_proc) }
   end
 
   def test_new

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

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