summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/OMXCodec.cpp
diff options
context:
space:
mode:
authorWei Jia <wjia@google.com>2015-08-21 16:49:51 -0700
committerWei Jia <wjia@google.com>2015-08-21 16:49:51 -0700
commit76dea1de8c92588358923300cbbc038144d302eb (patch)
tree04e770c6c7fc7cea5b79f98515bebb13f94d5ee5 /media/libstagefright/OMXCodec.cpp
parente857d28d48e6088d4cf5fcbed7f411c73622b388 (diff)
downloadframeworks_av-76dea1de8c92588358923300cbbc038144d302eb.zip
frameworks_av-76dea1de8c92588358923300cbbc038144d302eb.tar.gz
frameworks_av-76dea1de8c92588358923300cbbc038144d302eb.tar.bz2
libstagefright: check overflow before memory allocation in OMXCodec.cpp
Bug: 23416608 Change-Id: I4dacd38ed42db8f4887c3ee386dc909451f4346f
Diffstat (limited to 'media/libstagefright/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 96aa808..b1dde80 100644
--- a/media/libstagefright/OMXCodec.cpp
+++ b/media/libstagefright/OMXCodec.cpp
@@ -1658,6 +1658,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");