mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* numeric.c (fix_aref): avoid a possible undefined behavior.
1L << 63 on 64-bit platform is undefined, at least, according to ISO/IEC 9899 (C99) 6.5.7. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43222 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
24cf72029f
commit
487a25d29b
2 changed files with 7 additions and 1 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
Thu Oct 10 00:02:35 2013 Yusuke Endoh <mame@tsg.ne.jp>
|
||||||
|
|
||||||
|
* numeric.c (fix_aref): avoid a possible undefined behavior.
|
||||||
|
1L << 63 on 64-bit platform is undefined, at least, according to
|
||||||
|
ISO/IEC 9899 (C99) 6.5.7.
|
||||||
|
|
||||||
Wed Oct 9 23:57:02 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Wed Oct 9 23:57:02 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* object.c (id_for_attr): avoid inadvertent symbol creation.
|
* object.c (id_for_attr): avoid inadvertent symbol creation.
|
||||||
|
|
|
@ -3443,7 +3443,7 @@ fix_aref(VALUE fix, VALUE idx)
|
||||||
i = FIX2LONG(idx);
|
i = FIX2LONG(idx);
|
||||||
|
|
||||||
if (i < 0) return INT2FIX(0);
|
if (i < 0) return INT2FIX(0);
|
||||||
if (SIZEOF_LONG*CHAR_BIT-1 < i) {
|
if (SIZEOF_LONG*CHAR_BIT-1 <= i) {
|
||||||
if (val < 0) return INT2FIX(1);
|
if (val < 0) return INT2FIX(1);
|
||||||
return INT2FIX(0);
|
return INT2FIX(0);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue