summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorWei Jia <wjia@google.com>2015-08-21 16:49:51 -0700
committerWolfgang Wiedmeyer <wolfgit@wiedmeyer.de>2015-10-19 03:00:29 +0200
commit1cf71322e0953e67d1c8ea7d37366c9e443ec4d9 (patch)
tree19ef62407d4e493f285964ca213b1f74e5e0f229 /media
parent6067ac044bec6a422c7782973b8627a925fd0d8f (diff)
downloadframeworks_av-1cf71322e0953e67d1c8ea7d37366c9e443ec4d9.zip
frameworks_av-1cf71322e0953e67d1c8ea7d37366c9e443ec4d9.tar.gz
frameworks_av-1cf71322e0953e67d1c8ea7d37366c9e443ec4d9.tar.bz2
libstagefright: check overflow before memory allocation in OMXCodec.cppHEADmaster
Bug: 23416608 Change-Id: I4dacd38ed42db8f4887c3ee386dc909451f4346f Tested-by: Wolfgang Wiedmeyer <wolfgit@wiedmeyer.de>
Diffstat (limited to 'media')
-rw-r--r--media/libstagefright/OMXCodec.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp
index 91ba093..6fb05d2 100644
--- a/media/libstagefright/OMXCodec.cpp
+++ b/media/libstagefright/OMXCodec.cpp
@@ -1912,6 +1912,9 @@ status_t OMXCodec::allocateBuffersOnPort(OMX_U32 portIndex) {
def.nBufferCountActual, def.nBufferSize,
portIndex == kPortIndexInput ? "input" : "output");
+ if (def.nBufferSize != 0 && def.nBufferCountActual > SIZE_MAX / def.nBufferSize) {
+ return BAD_VALUE;
+ }
size_t totalSize = def.nBufferCountActual * def.nBufferSize;
mDealer[portIndex] = new MemoryDealer(totalSize, "OMXCodec");