diff options
author | Andreas Huber <andih@google.com> | 2011-03-21 14:16:03 -0700 |
---|---|---|
committer | Andreas Huber <andih@google.com> | 2011-03-21 14:16:03 -0700 |
commit | 310962976d575c0a97ec7a768e9cca0b2361daea (patch) | |
tree | 59bff634240c22e21f4dd35f8b01780e9a42e25e /media | |
parent | 39068e0fa09e1e342d8cb2280edc5d1941e93bd5 (diff) | |
download | frameworks_av-310962976d575c0a97ec7a768e9cca0b2361daea.zip frameworks_av-310962976d575c0a97ec7a768e9cca0b2361daea.tar.gz frameworks_av-310962976d575c0a97ec7a768e9cca0b2361daea.tar.bz2 |
If nothing is to be copied, return right away.
This avoids a potential out-of-bounds problem in the code below.
Change-Id: I942d55da0a5288b37512cb74407f900a2d824c0c
related-to-bug: 4139974
Diffstat (limited to 'media')
-rw-r--r-- | media/libstagefright/NuCachedSource2.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/media/libstagefright/NuCachedSource2.cpp b/media/libstagefright/NuCachedSource2.cpp index c7b99b9..248b678 100644 --- a/media/libstagefright/NuCachedSource2.cpp +++ b/media/libstagefright/NuCachedSource2.cpp @@ -135,6 +135,10 @@ size_t PageCache::releaseFromStart(size_t maxBytes) { void PageCache::copy(size_t from, void *data, size_t size) { LOGV("copy from %d size %d", from, size); + if (size == 0) { + return; + } + CHECK_LE(from + size, mTotalSize); size_t offset = 0; |