aboutsummaryrefslogtreecommitdiffstats
path: root/time.c
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-03-22 01:37:01 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-03-22 01:37:01 +0000
commitf1b74d1b6101a4f6c7dcb67b91d51015f8dedd37 (patch)
tree83dac67f65f6b1a76121ac941d26e1b264207c4e /time.c
parentbffbf245b7b03953c58a10b47ed16a87cda6dbf5 (diff)
downloadruby-f1b74d1b6101a4f6c7dcb67b91d51015f8dedd37.tar.gz
* 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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54225 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'time.c')
-rw-r--r--time.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/time.c b/time.c
index 2b37bdef71..11602bf8cc 100644
--- a/time.c
+++ b/time.c
@@ -461,8 +461,8 @@ static wideval_t
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
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)));
}