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

Commit 2c878cfd authored by Chong Zhang's avatar Chong Zhang
Browse files

stagefright: don't use stale pointer after disconnecting NuCachedSource2

bug: 20858729
Change-Id: I7d680accb43a4aa08620acd96659b97e80d1a5e8
parent 8eddd885
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -583,6 +583,13 @@ ssize_t NuCachedSource2::readInternal(off64_t offset, void *data, size_t size) {

    Mutex::Autolock autoLock(mLock);

    // If we're disconnecting, return EOS and don't access *data pointer.
    // data could be on the stack of the caller to NuCachedSource2::readAt(),
    // which may have exited already.
    if (mDisconnecting) {
        return ERROR_END_OF_STREAM;
    }

    if (!mFetching) {
        mLastAccessPos = offset;
        restartPrefetcherIfNecessary_l(