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

Commit a8eccec7 authored by Eric Laurent's avatar Eric Laurent
Browse files

ToneGenerator: fix overflow in stopTone

Fix overflow in tone duration calculation introduced in
commit 681be039.

Bug 6607077

Change-Id: Ie12f13701345c2b2d3be0b3c4d71cbfa2394a29b
parent 681be039
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -1000,7 +1000,7 @@ void ToneGenerator::stopTone() {
                } else {
                    // mSamplingRate is always > 1000
                    sec = sec * 1000 + nsec / 1000000; // duration in milliseconds
                    mMaxSmp = (sec * mSamplingRate) / 1000;
                    mMaxSmp = (unsigned int)(((int64_t)sec * mSamplingRate) / 1000);
                }
                ALOGV("stopTone() forcing mMaxSmp to %d, total for far %d", mMaxSmp,  mTotalSmp);
            } else {