Skip to content

Commit

Permalink
IOMX: Add buffer range check to emptyBuffer
Browse files Browse the repository at this point in the history
Bug: 20634516
Change-Id: If351dbd573bb4aeb6968bfa33f6d407225bc752c
(cherry picked from commit d971df0)
  • Loading branch information
xt0032rus authored and ciwrl committed Aug 12, 2015
1 parent 626ad26 commit bbf542d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions media/libstagefright/omx/OMXNodeInstance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -876,6 +876,12 @@ status_t OMXNodeInstance::emptyBuffer(
Mutex::Autolock autoLock(mLock);

OMX_BUFFERHEADERTYPE *header = findBufferHeader(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;
Expand Down

0 comments on commit bbf542d

Please sign in to comment.