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

ruby-changes:11817

From: nobu <ko1@a...>
Date: Sun, 17 May 2009 13:15:51 +0900 (JST)
Subject: [ruby-changes:11817] Ruby:r23472 (trunk): * vm.c (rb_vm_get_sourceline): should not access out of bound.

nobu	2009-05-17 13:15:33 +0900 (Sun, 17 May 2009)

  New Revision: 23472

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

  Log:
    * vm.c (rb_vm_get_sourceline): should not access out of bound.

  Modified files:
    trunk/ChangeLog
    trunk/vm.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 23471)
+++ ChangeLog	(revision 23472)
@@ -1,3 +1,7 @@
+Sun May 17 13:15:32 2009  Nobuyoshi Nakada  <nobu@r...>
+
+	* vm.c (rb_vm_get_sourceline): should not access out of bound.
+
 Sun May 17 09:47:48 2009  Nobuyoshi Nakada  <nobu@r...>
 
 	* ruby.c (cmdline_options_init): initialize encodings.
Index: vm.c
===================================================================
--- vm.c	(revision 23471)
+++ vm.c	(revision 23472)
@@ -673,10 +673,11 @@
 
     if (RUBY_VM_NORMAL_ISEQ_P(iseq)) {
 	rb_num_t i;
-	int pos = cfp->pc - cfp->iseq->iseq_encoded;
+	size_t pos = cfp->pc - cfp->iseq->iseq_encoded;
 
 	for (i = 0; i < iseq->insn_info_size; i++) {
 	    if (iseq->insn_info_table[i].position == pos) {
+		if (i == 0) goto found;
 		line_no = iseq->insn_info_table[i - 1].line_no;
 		goto found;
 	    }
@@ -1462,7 +1463,7 @@
 static int thread_recycle_stack_count = 0;
 
 static VALUE *
-thread_recycle_stack(int size)
+thread_recycle_stack(size_t size)
 {
     if (thread_recycle_stack_count) {
 	return thread_recycle_stack_slot[--thread_recycle_stack_count];
@@ -1675,7 +1676,7 @@
 {
     NODE *newbody;
     VALUE klass = cref->nd_clss;
-    int noex = cref->nd_visi;
+    int noex = (int)cref->nd_visi;
     rb_iseq_t *miseq;
     GetISeqPtr(iseqval, miseq);
 

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

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