summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWei Jia <wjia@google.com>2015-08-23 19:08:27 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-08-23 19:08:27 +0000
commit0f3ab16c827a43534597cb38515951ff736f9740 (patch)
tree95080853408701da82e7bccc60632cb6fd655fb2
parent09f71c5621799e0f030b4a8058d2fb4df5977de0 (diff)
parentaf7e33f6043c0be1c0310d675884e3b263ca2438 (diff)
downloadframeworks_av-0f3ab16c827a43534597cb38515951ff736f9740.zip
frameworks_av-0f3ab16c827a43534597cb38515951ff736f9740.tar.gz
frameworks_av-0f3ab16c827a43534597cb38515951ff736f9740.tar.bz2
am af7e33f6: libstagefright: check overflow before memory allocation in OMXCodec.cpp
* commit 'af7e33f6043c0be1c0310d675884e3b263ca2438': libstagefright: check overflow before memory allocation in OMXCodec.cpp
-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 625922f..e17f482 100644
--- a/media/libstagefright/OMXCodec.cpp
+++ b/media/libstagefright/OMXCodec.cpp
@@ -1559,6 +1559,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");