diff --git a/widget/gonk/GeckoTouchDispatcher.cpp b/widget/gonk/GeckoTouchDispatcher.cpp index 24053ef7623..cfd6598d85e 100644 --- a/widget/gonk/GeckoTouchDispatcher.cpp +++ b/widget/gonk/GeckoTouchDispatcher.cpp @@ -294,7 +294,7 @@ GeckoTouchDispatcher::ResampleTouchMoves(MultiTouchInput& aOutTouch, TimeStamp a TimeDuration touchDiff = currentTouch.mTimeStamp - baseTouch.mTimeStamp; if (currentTouch.mTimeStamp < sampleTime) { - TimeDuration maxResampleTime = std::min(touchDiff / 2, mMaxPredict); + TimeDuration maxResampleTime = std::min(touchDiff / int64_t(2), mMaxPredict); TimeStamp maxTimestamp = currentTouch.mTimeStamp + maxResampleTime; if (sampleTime > maxTimestamp) { sampleTime = maxTimestamp; diff --git a/xpcom/ds/TimeStamp.h b/xpcom/ds/TimeStamp.h index fdb87559d60..036ef578c30 100644 --- a/xpcom/ds/TimeStamp.h +++ b/xpcom/ds/TimeStamp.h @@ -181,6 +181,11 @@ private: // If required, use MultDouble explicitly and with care. BaseTimeDuration operator*(const double aMultiplier) const = delete; + // Block double divisor (for the same reason, and because dividing by + // fractional values would otherwise invoke the int64_t variant, and rounding + // the passed argument can then cause divide-by-zero) - Bug 1147491. + BaseTimeDuration operator/(const double aDivisor) const = delete; + public: BaseTimeDuration MultDouble(double aMultiplier) const {