summaryrefslogtreecommitdiff
path: root/vm.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-05-17 04:15:33 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-05-17 04:15:33 +0000
commit52b3bf363ad4f67d79226e2d0e3143d4f85f31c5 (patch)
tree5ed8d1e5a0c459f999909f95eaa6fce470b6f4e5 /vm.c
parentcda453c238054963535b51fe45d9d67159917220 (diff)
* vm.c (rb_vm_get_sourceline): should not access out of bound.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23472 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm.c')
-rw-r--r--vm.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/vm.c b/vm.c
index 0b05de1a7c..b38bcdf16f 100644
--- a/vm.c
+++ b/vm.c
@@ -673,10 +673,11 @@ rb_vm_get_sourceline(const rb_control_frame_t *cfp)
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 VALUE *thread_recycle_stack_slot[RECYCLE_MAX];
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 @@ vm_define_method(rb_thread_t *th, VALUE obj, ID id, VALUE iseqval,
{
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);