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

ruby-changes:42098

From: nobu <ko1@a...>
Date: Fri, 18 Mar 2016 16:22:31 +0900 (JST)
Subject: [ruby-changes:42098] nobu:r54172 (trunk): parse.y: Fix for nth_ref_max

nobu	2016-03-18 16:22:26 +0900 (Fri, 18 Mar 2016)

  New Revision: 54172

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

  Log:
    parse.y: Fix for nth_ref_max
    
    * parse.y (parse_numvar): NTH_REF must be less than a half of
      INT_MAX, as it is left-shifted to be ORed with back-ref flag.
      [ruby-core:74444] [Bug#12192] [Fix GH-1296]

  Modified files:
    trunk/ChangeLog
    trunk/parse.y
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 54171)
+++ ChangeLog	(revision 54172)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Fri Mar 18 16:22:24 2016  Victor Nawothnig  <Victor.Nawothnig@g...>
+
+	* parse.y (parse_numvar): NTH_REF must be less than a half of
+	  INT_MAX, as it is left-shifted to be ORed with back-ref flag.
+	  [ruby-core:74444] [Bug#12192] [Fix GH-1296]
+
 Fri Mar 18 12:25:30 2016  Nobuyoshi Nakada  <nobu@r...>
 
 	* gc.c (tick): fix missing close parenthesis.  [Fix GH-1291]
Index: parse.y
===================================================================
--- parse.y	(revision 54171)
+++ parse.y	(revision 54172)
@@ -7833,7 +7833,7 @@ parse_numvar(struct parser_params *parse https://github.com/ruby/ruby/blob/trunk/parse.y#L7833
     int overflow;
     unsigned long n = ruby_scan_digits(tok()+1, toklen()-1, 10, &len, &overflow);
     const unsigned long nth_ref_max =
-	(FIXNUM_MAX / 2 < INT_MAX) ? FIXNUM_MAX / 2 : INT_MAX;
+	((FIXNUM_MAX < INT_MAX) ? FIXNUM_MAX : INT_MAX) >> 1;
     /* NTH_REF is left-shifted to be ORed with back-ref flag and
      * turned into a Fixnum, in compile.c */
 

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

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