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 | 7a3cc69779ac2689340311f7b994b989c5b11e69 (patch) | |
tree | 2c4e65561668280e62f61516a71b2b9e7a79cacb /parse.y | |
parent | b14ed1bb5d8541cf115f857815052f0172f846b3 (diff) | |
download | ruby-7a3cc69779ac2689340311f7b994b989c5b11e69.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
Diffstat (limited to 'parse.y')
-rw-r--r-- | parse.y | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -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 */ |