summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWei Jia <wjia@google.com>2015-08-24 23:17:50 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-08-24 23:17:50 +0000
commitdddf932f2e58dab3ae183f720f44ca35fca52765 (patch)
tree2c1a6e6d58b805964dfc5c37f79919d4de9c7e25
parenta6bafbc5da25db600d7311c0ba47a3fe034b4471 (diff)
parent41de4ba1d896c4e8ab7df24d10ca7d5109fbd323 (diff)
downloadframeworks_av-dddf932f2e58dab3ae183f720f44ca35fca52765.zip
frameworks_av-dddf932f2e58dab3ae183f720f44ca35fca52765.tar.gz
frameworks_av-dddf932f2e58dab3ae183f720f44ca35fca52765.tar.bz2
am 41de4ba1: am cf69487d: am 6f80b09f: am 252a8c09: am 0f3ab16c: am af7e33f6: libstagefright: check overflow before memory allocation in OMXCodec.cpp
* commit '41de4ba1d896c4e8ab7df24d10ca7d5109fbd323': 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 4d30069..f41bbc2 100644
--- a/media/libstagefright/OMXCodec.cpp
+++ b/media/libstagefright/OMXCodec.cpp
@@ -1654,6 +1654,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");