summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/NuCachedSource2.cpp
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2011-05-04 11:43:43 -0700
committerAndreas Huber <andih@google.com>2011-05-04 11:43:43 -0700
commit67802977b6f0aa8d6f14f85dadcf32a3cadb9c07 (patch)
treeffa2df57c4ddd67c64244c78e214de97304e48a4 /media/libstagefright/NuCachedSource2.cpp
parent89dc0dffdcbf0999a854a9b1bbea8f56395cc209 (diff)
downloadframeworks_av-67802977b6f0aa8d6f14f85dadcf32a3cadb9c07.zip
frameworks_av-67802977b6f0aa8d6f14f85dadcf32a3cadb9c07.tar.gz
frameworks_av-67802977b6f0aa8d6f14f85dadcf32a3cadb9c07.tar.bz2
Fix potential memory corruption in NuCachedSource2.
Change-Id: Ia6bd2d4966287228a3ac1b067ee1f1ccad965dbb related-to-bug: 4354845
Diffstat (limited to 'media/libstagefright/NuCachedSource2.cpp')
-rw-r--r--media/libstagefright/NuCachedSource2.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/media/libstagefright/NuCachedSource2.cpp b/media/libstagefright/NuCachedSource2.cpp
index dc86885..81f2e47 100644
--- a/media/libstagefright/NuCachedSource2.cpp
+++ b/media/libstagefright/NuCachedSource2.cpp
@@ -450,6 +450,11 @@ ssize_t NuCachedSource2::readInternal(off64_t offset, void *data, size_t size) {
}
size_t avail = mCache->totalSize() - delta;
+
+ if (avail > size) {
+ avail = size;
+ }
+
mCache->copy(delta, data, avail);
return avail;