Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7a6a0f0a authored by Andy Hung's avatar Andy Hung
Browse files

AudioFlinger: Fix unsigned overflow

Can occur on duplicating thread shutdown with no output tracks.

Test: compiles
Bug: 312949498
Change-Id: I7a979c547238bc1a2b24f7cdbbee61514006d6e8
parent 9f43a403
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -7758,7 +7758,8 @@ void DuplicatingThread::sendMetadataToBackend_l(

uint32_t DuplicatingThread::activeSleepTimeUs() const
{
    return (mWaitTimeMs * 1000) / 2;
    // return half the wait time in microseconds.
    return std::min(mWaitTimeMs * 500ULL, (unsigned long long)UINT32_MAX);  // prevent overflow.
}

void DuplicatingThread::cacheParameters_l()