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

ruby-changes:22254

From: nobu <ko1@a...>
Date: Sat, 14 Jan 2012 21:56:56 +0900 (JST)
Subject: [ruby-changes:22254] nobu:r34303 (trunk): * iseq.c (iseq_data_to_ary): check line info table boundary. line

nobu	2012-01-14 21:56:46 +0900 (Sat, 14 Jan 2012)

  New Revision: 34303

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

  Log:
    * iseq.c (iseq_data_to_ary): check line info table boundary.  line
      number 0 means no line number info is needed.  [ruby-dev:45130]
      [Bug #5894]

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

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 34302)
+++ ChangeLog	(revision 34303)
@@ -1,3 +1,9 @@
+Sat Jan 14 21:56:43 2012  Nobuyoshi Nakada  <nobu@r...>
+
+	* iseq.c (iseq_data_to_ary): check line info table boundary.  line
+	  number 0 means no line number info is needed.  [ruby-dev:45130]
+	  [Bug #5894]
+
 Sat Jan 14 18:24:13 2012  CHIKANAGA Tomoyuki  <nagachika00@g...>
 
 	* error.c (exc_equal): clear rb_thread_t::errinfo when ignore
Index: iseq.c
===================================================================
--- iseq.c	(revision 34302)
+++ iseq.c	(revision 34303)
@@ -1104,7 +1104,8 @@
 static VALUE
 iseq_data_to_ary(rb_iseq_t *iseq)
 {
-    long i, ti;
+    long i;
+    size_t ti;
     unsigned int pos;
     unsigned int line = 0;
     VALUE *seq;
@@ -1315,7 +1316,7 @@
 	    rb_ary_push(body, (VALUE)label);
 	}
 
-	if (iseq->line_info_table[ti].position == pos) {
+	if (iseq->line_info_size < ti && iseq->line_info_table[ti].position == pos) {
 	    line = iseq->line_info_table[ti].line_no;
 	    rb_ary_push(body, INT2FIX(line));
 	    ti++;
Index: test/ruby/test_iseq.rb
===================================================================
--- test/ruby/test_iseq.rb	(revision 0)
+++ test/ruby/test_iseq.rb	(revision 34303)
@@ -0,0 +1,11 @@
+require 'test/unit'
+require_relative 'envutil'
+
+class TestISeq < Test::Unit::TestCase
+  ISeq = RubyVM::InstructionSequence
+
+  def test_no_linenum
+    bug5894 = '[ruby-dev:45130]'
+    assert_normal_exit('p RubyVM::InstructionSequence.compile("1", "mac", "", 0).to_a', bug5894)
+  end
+end

Property changes on: test/ruby/test_iseq.rb
___________________________________________________________________
Added: svn:eol-style
   + LF


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

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