From 0492a5a61b32a8b47cda82428457036a2cbb04e4 Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 19 Jan 2018 03:09:24 +0000 Subject: vm_insnhelper.c: fix many keyword arguments * vm_insnhelper.c (vm_check_keyword): if the index exceeds the width of unspecified bits, that argument is specified. `unspecified_bits` still be a fixnum if the actual arguments do not exceed the limit, regardless the formal parameters size. [ruby-core:84921] [Bug #14373] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61940 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- vm_args.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'vm_args.c') diff --git a/vm_args.c b/vm_args.c index c61f50d933..c1d829c019 100644 --- a/vm_args.c +++ b/vm_args.c @@ -392,6 +392,8 @@ args_setup_kw_parameters_lookup(const ID key, VALUE *ptr, const VALUE *const pas return FALSE; } +#define KW_SPECIFIED_BITS_MAX 32 /* TODO: 32 -> Fixnum's max bits */ + static void args_setup_kw_parameters(rb_execution_context_t *const ec, const rb_iseq_t *const iseq, VALUE *const passed_values, const int passed_keyword_len, const VALUE *const passed_keywords, @@ -427,7 +429,7 @@ args_setup_kw_parameters(rb_execution_context_t *const ec, const rb_iseq_t *cons if (default_values[di] == Qundef) { locals[i] = Qnil; - if (LIKELY(i < 32)) { /* TODO: 32 -> Fixnum's max bits */ + if (LIKELY(i < KW_SPECIFIED_BITS_MAX)) { unspecified_bits |= 0x01 << di; } else { @@ -436,7 +438,7 @@ args_setup_kw_parameters(rb_execution_context_t *const ec, const rb_iseq_t *cons int j; unspecified_bits_value = rb_hash_new(); - for (j=0; j<32; j++) { + for (j=0; j