зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1351094
- Catch div/0 when hz==0 in MPEG4Extractor's unitsToUs - r=alfredo
MozReview-Commit-ID: KLgUg3UYiNQ --HG-- extra : rebase_source : 45c26f5cea0e2d11eee785ae3255fe341707a55d
This commit is contained in:
Родитель
44d96daa9b
Коммит
30bc48ac6f
|
@ -48,8 +48,11 @@ namespace stagefright {
|
|||
static const int64_t OVERFLOW_ERROR = -INT64_MAX;
|
||||
|
||||
// Calculate units*1,000,000/hz, trying to avoid overflow.
|
||||
// Return OVERFLOW_ERROR in case of unavoidable overflow.
|
||||
// Return OVERFLOW_ERROR in case of unavoidable overflow, or div by hz==0.
|
||||
int64_t unitsToUs(int64_t units, int64_t hz) {
|
||||
if (hz == 0) {
|
||||
return OVERFLOW_ERROR;
|
||||
}
|
||||
const int64_t MAX_S = INT64_MAX / 1000000;
|
||||
if (std::abs(units) <= MAX_S) {
|
||||
return units * 1000000 / hz;
|
||||
|
|
Загрузка…
Ссылка в новой задаче