ruby-changes:18544
From: yugui <ko1@a...>
Date: Sun, 16 Jan 2011 21:40:39 +0900 (JST)
Subject: [ruby-changes:18544] Ruby:r30567 (ruby_1_9_2): merges r30483 from trunk into ruby_1_9_2.
yugui 2011-01-16 21:34:57 +0900 (Sun, 16 Jan 2011) New Revision: 30567 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=30567 Log: merges r30483 from trunk into ruby_1_9_2. -- * bignum.c (bigmul1_karatsuba): avoid overflow that make assertion fail in certain case. this patch is contributed from Ray Chason <chasonr at gmail.com> in personal communication. Modified files: branches/ruby_1_9_2/ChangeLog branches/ruby_1_9_2/bignum.c branches/ruby_1_9_2/version.h Index: ruby_1_9_2/ChangeLog =================================================================== --- ruby_1_9_2/ChangeLog (revision 30566) +++ ruby_1_9_2/ChangeLog (revision 30567) @@ -1,3 +1,9 @@ +Thu Jan 6 22:42:02 2011 Yukihiro Matsumoto <matz@r...> + + * bignum.c (bigmul1_karatsuba): avoid overflow that make assertion + fail in certain case. this patch is contributed from Ray Chason + <chasonr at gmail.com> in personal communication. + Thu Jan 6 11:27:01 2011 Aaron Patterson <aaron@t...> * ext/psych/lib/psych/json/tree_builder.rb (start_mapping): tags Index: ruby_1_9_2/version.h =================================================================== --- ruby_1_9_2/version.h (revision 30566) +++ ruby_1_9_2/version.h (revision 30567) @@ -1,5 +1,5 @@ #define RUBY_VERSION "1.9.2" -#define RUBY_PATCHLEVEL 147 +#define RUBY_PATCHLEVEL 148 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 9 #define RUBY_VERSION_TEENY 1 Index: ruby_1_9_2/bignum.c =================================================================== --- ruby_1_9_2/bignum.c (revision 30566) +++ ruby_1_9_2/bignum.c (revision 30567) @@ -2157,15 +2157,15 @@ t3 = bigmul0(xh, yh); i = xn + yn - n; + /* subtract t1 from t3 */ + bigsub_core(BDIGITS(t3), big_real_len(t3), BDIGITS(t1), t1n, BDIGITS(t3), big_real_len(t3)); + + /* subtract t2 from t3; t3 is now the middle term of the product */ + if (t2 != Qundef) bigsub_core(BDIGITS(t3), big_real_len(t3), BDIGITS(t2), t2n, BDIGITS(t3), big_real_len(t3)); + /* add t3 to middle bytes of the result (z1) */ bigadd_core(zds + n, i, BDIGITS(t3), big_real_len(t3), zds + n, i); - /* subtract t1 from middle bytes of the result (z1) */ - bigsub_core(zds + n, i, BDIGITS(t1), t1n, zds + n, i); - - /* subtract t2 from middle bytes of the result (z1) */ - if (t2 != Qundef) bigsub_core(zds + n, i, BDIGITS(t2), t2n, zds + n, i); - return z; } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/