summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/NuCachedSource2.cpp
diff options
context:
space:
mode:
authorChong Zhang <chz@google.com>2015-05-19 10:56:40 -0700
committerChong Zhang <chz@google.com>2015-05-19 10:58:56 -0700
commit2c878cfdf36b896abb99e62a37188cc92cd4fe6e (patch)
tree02879a5bba582a747c55291d32e0cba13bc84863 /media/libstagefright/NuCachedSource2.cpp
parent8eddd88568fe4da0ca0ceab5072bc488827f01b5 (diff)
downloadframeworks_av-2c878cfdf36b896abb99e62a37188cc92cd4fe6e.zip
frameworks_av-2c878cfdf36b896abb99e62a37188cc92cd4fe6e.tar.gz
frameworks_av-2c878cfdf36b896abb99e62a37188cc92cd4fe6e.tar.bz2
stagefright: don't use stale pointer after disconnecting NuCachedSource2
bug: 20858729 Change-Id: I7d680accb43a4aa08620acd96659b97e80d1a5e8
Diffstat (limited to 'media/libstagefright/NuCachedSource2.cpp')
-rw-r--r--media/libstagefright/NuCachedSource2.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/media/libstagefright/NuCachedSource2.cpp b/media/libstagefright/NuCachedSource2.cpp
index 1c53b40..f82636b 100644
--- a/media/libstagefright/NuCachedSource2.cpp
+++ b/media/libstagefright/NuCachedSource2.cpp
@@ -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(