ruby-changes:42151
From: usa <ko1@a...>
Date: Tue, 22 Mar 2016 10:37:06 +0900 (JST)
Subject: [ruby-changes:42151] usa:r54225 (trunk): * time.c (wdiv, wmod): wdivmod0() assumes the 3rd and the 4th arguments
usa 2016-03-22 10:37:01 +0900 (Tue, 22 Mar 2016) New Revision: 54225 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=54225 Log: * time.c (wdiv, wmod): wdivmod0() assumes the 3rd and the 4th arguments are valid pointers. maybe checking them in wdivmod0() is better manner, but I guess that passing real dummy pointers may be faster than checking and branching in wdivmod0(). this commit fixes SEGV on 32bit and LLP64 platforms. Modified files: trunk/ChangeLog trunk/time.c Index: ChangeLog =================================================================== --- ChangeLog (revision 54224) +++ ChangeLog (revision 54225) @@ -1,3 +1,12 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Tue Mar 22 10:31:34 2016 NAKAMURA Usaku <usa@r...> + + * time.c (wdiv, wmod): wdivmod0() assumes the 3rd and the 4th arguments + are valid pointers. + maybe checking them in wdivmod0() is better manner, but I guess that + passing real dummy pointers may be faster than checking and branching + in wdivmod0(). + this commit fixes SEGV on 32bit and LLP64 platforms. + Tue Mar 22 10:24:04 2016 NAKAMURA Usaku <usa@r...> * time.c (divmodv): void function never returns any value. Index: time.c =================================================================== --- time.c (revision 54224) +++ time.c (revision 54225) @@ -461,8 +461,8 @@ static wideval_t https://github.com/ruby/ruby/blob/trunk/time.c#L461 wdiv(wideval_t wx, wideval_t wy) { #if WIDEVALUE_IS_WIDER - wideval_t q; - if (wdivmod0(wx, wy, &q, NULL)) return q; + wideval_t q, dmy; + if (wdivmod0(wx, wy, &q, &dmy)) return q; #endif return v2w(div(w2v(wx), w2v(wy))); } @@ -471,8 +471,8 @@ static wideval_t https://github.com/ruby/ruby/blob/trunk/time.c#L471 wmod(wideval_t wx, wideval_t wy) { #if WIDEVALUE_IS_WIDER - wideval_t r; - if (wdivmod0(wx, wy, NULL, &r)) return r; + wideval_t r, dmy; + if (wdivmod0(wx, wy, &dmy, &r)) return r; #endif return v2w(mod(w2v(wx), w2v(wy))); } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/