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

Commit 1bf291a7 authored by vivek mehta's avatar vivek mehta Committed by Steve Kondik
Browse files

libstagefright: Check for duration > 0 to avoid DivideByZero crash

- duration = 0 can cause divide by zero and for this clip duration
  is indiacted as 0.
- check for duration > 0 rather than duration >= 0

Change-Id: I58ccacbf7ede892dff9626715162ea7b1f2ddbc6
CRs-Fixed: 451855
parent 390e2b19
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -638,7 +638,7 @@ void AwesomePlayer::notifyListener_l(int msg, int ext1, int ext2) {

bool AwesomePlayer::getBitrate(int64_t *bitrate) {
    off64_t size;
    if (mDurationUs >= 0 && mCachedSource != NULL
    if (mDurationUs > 0 && mCachedSource != NULL
            && mCachedSource->getSize(&size) == OK) {
        *bitrate = size * 8000000ll / mDurationUs;  // in bits/sec
        return true;