зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1074651 - Detect integer overflow in BaseTimeDuration::TicksFromMilliseconds; r=bz
This commit is contained in:
Родитель
b0e7dc53e1
Коммит
cf167e36af
|
@ -0,0 +1,4 @@
|
|||
<!DOCTYPE html>
|
||||
<html style="transition-duration: 500000000000000000ms">
|
||||
<body onload="document.documentElement.style.strokeWidth = '17px';"></body>
|
||||
</html>
|
|
@ -108,5 +108,6 @@ load 992333-1.html
|
|||
pref(dom.webcomponents.enabled,true) load 1017798-1.html
|
||||
load 1028514-1.html
|
||||
load 1066089-1.html
|
||||
load 1074651-1.html
|
||||
load large_border_image_width.html
|
||||
load border-image-visited-link.html
|
||||
|
|
|
@ -103,7 +103,14 @@ int64_t
|
|||
BaseTimeDurationPlatformUtils::TicksFromMilliseconds(double aMilliseconds)
|
||||
{
|
||||
NS_ABORT_IF_FALSE(gInitialized, "calling TimeDuration too early");
|
||||
return (aMilliseconds * kNsPerMsd) / sNsPerTick;
|
||||
double result = (aMilliseconds * kNsPerMsd) / sNsPerTick;
|
||||
if (result > INT64_MAX) {
|
||||
return INT64_MAX;
|
||||
} else if (result < INT64_MIN) {
|
||||
return INT64_MIN;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
int64_t
|
||||
|
|
|
@ -152,7 +152,14 @@ BaseTimeDurationPlatformUtils::ToSecondsSigDigits(int64_t aTicks)
|
|||
int64_t
|
||||
BaseTimeDurationPlatformUtils::TicksFromMilliseconds(double aMilliseconds)
|
||||
{
|
||||
return aMilliseconds * kNsPerMsd;
|
||||
double result = aMilliseconds * kNsPerMsd;
|
||||
if (result > INT64_MAX) {
|
||||
return INT64_MAX;
|
||||
} else if (result < INT64_MIN) {
|
||||
return INT64_MIN;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
int64_t
|
||||
|
|
|
@ -434,7 +434,14 @@ BaseTimeDurationPlatformUtils::ToSecondsSigDigits(int64_t aTicks)
|
|||
int64_t
|
||||
BaseTimeDurationPlatformUtils::TicksFromMilliseconds(double aMilliseconds)
|
||||
{
|
||||
return ms2mt(aMilliseconds);
|
||||
double result = ms2mt(aMilliseconds);
|
||||
if (result > INT64_MAX) {
|
||||
return INT64_MAX;
|
||||
} else if (result < INT64_MIN) {
|
||||
return INT64_MIN;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
int64_t
|
||||
|
|
Загрузка…
Ссылка в новой задаче