ruby-changes:44245
From: usa <ko1@a...>
Date: Sun, 2 Oct 2016 02:04:09 +0900 (JST)
Subject: [ruby-changes:44245] usa:r56318 (trunk): * numeric.c (rb_fix2str): detect unnormalized Fixnum value.
usa 2016-10-02 02:04:04 +0900 (Sun, 02 Oct 2016) New Revision: 56318 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=56318 Log: * numeric.c (rb_fix2str): detect unnormalized Fixnum value. Modified files: trunk/ChangeLog trunk/numeric.c Index: ChangeLog =================================================================== --- ChangeLog (revision 56317) +++ ChangeLog (revision 56318) @@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Sun Oct 2 02:03:06 2016 NAKAMURA Usaku <usa@r...> + + * numeric.c (rb_fix2str): detect unnormalized Fixnum value. + Sat Oct 1 23:08:47 2016 NAKAMURA Usaku <usa@r...> * ext/date/date_parse.c (date_zone_to_diff): it's nonsence and really Index: numeric.c =================================================================== --- numeric.c (revision 56317) +++ numeric.c (revision 56318) @@ -3267,6 +3267,17 @@ rb_fix2str(VALUE x, int base) https://github.com/ruby/ruby/blob/trunk/numeric.c#L3267 if (base < 2 || 36 < base) { rb_raise(rb_eArgError, "invalid radix %d", base); } +#if SIZEOF_LONG < SIZEOF_VOIDP +# if SIZEOF_VOIDP == SIZEOF_LONG_LONG + if ((val >= 0 && (x & 0xFFFFFFFF00000000ull)) || + (val < 0 && (x & 0xFFFFFFFF00000000ull) != 0xFFFFFFFF00000000ull)) { + rb_bug("Unnormalized Fixnum value %p", x); + } +# elif + /* should do something like above code, but currently ruby does not know */ + /* such platforms */ +# endif +#endif if (val == 0) { return rb_usascii_str_new2("0"); } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/