From 7b7210439cac9a1b6b35035cb59af8a4fd8488ee Mon Sep 17 00:00:00 2001 From: mame Date: Mon, 15 Nov 2010 14:44:19 +0000 Subject: [PATCH] * compile.c (iseq_set_exception_local_table, iseq_set_local_table, rb_iseq_build_from_ary): fix type inconsistency (which is benign because sizeof(ID) == sizeof(ID*), though). Coverity Scan found these bugs. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29799 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 7 +++++++ compile.c | 8 ++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8a5886765d..6e0963f941 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Mon Nov 15 23:41:21 2010 Yusuke Endoh + + * compile.c (iseq_set_exception_local_table, iseq_set_local_table, + rb_iseq_build_from_ary): fix type inconsistency (which is benign + because sizeof(ID) == sizeof(ID*), though). Coverity Scan found + these bugs. + Mon Nov 15 22:47:27 2010 Yusuke Endoh * vm_eval.c (rb_funcall): ensure va_end after va_init_list. Coverity diff --git a/compile.c b/compile.c index 971020d535..b9749f44f7 100644 --- a/compile.c +++ b/compile.c @@ -980,7 +980,7 @@ iseq_set_exception_local_table(rb_iseq_t *iseq) ID id_dollar_bang; CONST_ID(id_dollar_bang, "#$!"); - iseq->local_table = (ID *)ALLOC_N(ID *, 1); + iseq->local_table = (ID *)ALLOC_N(ID, 1); iseq->local_table_size = 1; iseq->local_size = iseq->local_table_size + 1; iseq->local_table[0] = id_dollar_bang; @@ -1199,8 +1199,8 @@ iseq_set_local_table(rb_iseq_t *iseq, ID *tbl) } if (size > 0) { - iseq->local_table = (ID *)ALLOC_N(ID *, size); - MEMCPY(iseq->local_table, tbl, ID *, size); + iseq->local_table = (ID *)ALLOC_N(ID, size); + MEMCPY(iseq->local_table, tbl, ID, size); } iseq->local_size = iseq->local_table_size = size; @@ -5372,7 +5372,7 @@ rb_iseq_build_from_ary(rb_iseq_t *iseq, VALUE locals, VALUE args, INIT_ANCHOR(anchor); iseq->local_table_size = RARRAY_LENINT(locals); - iseq->local_table = tbl = (ID *)ALLOC_N(ID *, iseq->local_table_size); + iseq->local_table = tbl = (ID *)ALLOC_N(ID, iseq->local_table_size); iseq->local_size = iseq->local_table_size + 1; for (i=0; i