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

ruby-changes:49827

From: nobu <ko1@a...>
Date: Fri, 19 Jan 2018 13:24:06 +0900 (JST)
Subject: [ruby-changes:49827] nobu:r61945 (trunk): vm_args.c: fix KW_SPECIFIED_BITS_MAX

nobu	2018-01-19 13:23:59 +0900 (Fri, 19 Jan 2018)

  New Revision: 61945

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=61945

  Log:
    vm_args.c: fix KW_SPECIFIED_BITS_MAX
    
    * vm_args.c (KW_SPECIFIED_BITS_MAX): subtracted 1bit for
      FIXNUM_FLAG.  [ruby-core:84921] [Bug #14373]
    
    * vm_insnhelper.c (vm_check_keyword): unsigned for bit operation.

  Modified files:
    trunk/vm_args.c
    trunk/vm_insnhelper.c
Index: vm_insnhelper.c
===================================================================
--- vm_insnhelper.c	(revision 61944)
+++ vm_insnhelper.c	(revision 61945)
@@ -3026,7 +3026,7 @@ vm_check_keyword(lindex_t bits, lindex_t https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L3026
     const VALUE kw_bits = *(ep - bits);
 
     if (FIXNUM_P(kw_bits)) {
-	int b = FIX2INT(kw_bits);
+	unsigned int b = (unsigned int)FIX2ULONG(kw_bits);
 	if ((idx < KW_SPECIFIED_BITS_MAX) && (b & (0x01 << idx)))
 	    return Qfalse;
     }
Index: vm_args.c
===================================================================
--- vm_args.c	(revision 61944)
+++ vm_args.c	(revision 61945)
@@ -392,7 +392,7 @@ args_setup_kw_parameters_lookup(const ID https://github.com/ruby/ruby/blob/trunk/vm_args.c#L392
     return FALSE;
 }
 
-#define KW_SPECIFIED_BITS_MAX 32 /* TODO: 32 -> Fixnum's max bits */
+#define KW_SPECIFIED_BITS_MAX (32-1) /* TODO: 32 -> Fixnum's max bits */
 
 static void
 args_setup_kw_parameters(rb_execution_context_t *const ec, const rb_iseq_t *const iseq,

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

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