summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Hung <hunga@google.com>2015-05-26 11:14:36 -0700
committerWolfgang Wiedmeyer <wolfgit@wiedmeyer.de>2015-10-18 13:42:17 +0200
commit09618087da140c4d4943682f3fda2c774f5f7a33 (patch)
treeb6085197eb6f72f9720d6dff28a560a9697664a2
parent07a749bc4798240576db362e23d03c2269b897da (diff)
downloadframeworks_av-09618087da140c4d4943682f3fda2c774f5f7a33.zip
frameworks_av-09618087da140c4d4943682f3fda2c774f5f7a33.tar.gz
frameworks_av-09618087da140c4d4943682f3fda2c774f5f7a33.tar.bz2
DO NOT MERGE - IOMX: Add buffer range check to emptyBuffer
Bug: 20634516 Change-Id: If351dbd573bb4aeb6968bfa33f6d407225bc752c
-rw-r--r--media/libstagefright/omx/OMXNodeInstance.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/media/libstagefright/omx/OMXNodeInstance.cpp b/media/libstagefright/omx/OMXNodeInstance.cpp
index e41b342..3c51885 100644
--- a/media/libstagefright/omx/OMXNodeInstance.cpp
+++ b/media/libstagefright/omx/OMXNodeInstance.cpp
@@ -637,6 +637,12 @@ status_t OMXNodeInstance::emptyBuffer(
Mutex::Autolock autoLock(mLock);
OMX_BUFFERHEADERTYPE *header = (OMX_BUFFERHEADERTYPE *)buffer;
+ // rangeLength and rangeOffset must be a subset of the allocated data in the buffer.
+ // corner case: we permit rangeOffset == end-of-buffer with rangeLength == 0.
+ if (rangeOffset > header->nAllocLen
+ || rangeLength > header->nAllocLen - rangeOffset) {
+ return BAD_VALUE;
+ }
header->nFilledLen = rangeLength;
header->nOffset = rangeOffset;
header->nFlags = flags;