diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-03-18 07:22:26 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-03-18 07:22:26 +0000 |
commit | a5c5b41192e7bc3afeaf9a2c76ca04908c505b06 (patch) | |
tree | 2c4e65561668280e62f61516a71b2b9e7a79cacb | |
parent | c55f2bc0c2f7e042ba9dabcd5cea617aa4754430 (diff) | |
download | ruby-a5c5b41192e7bc3afeaf9a2c76ca04908c505b06.tar.gz |
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]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54172 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | parse.y | 2 |
2 files changed, 7 insertions, 1 deletions
@@ -1,3 +1,9 @@ +Fri Mar 18 16:22:24 2016 Victor Nawothnig <Victor.Nawothnig@gmail.com> + + * 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@ruby-lang.org> * gc.c (tick): fix missing close parenthesis. [Fix GH-1291] @@ -7833,7 +7833,7 @@ parse_numvar(struct parser_params *parser) 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 */ |