summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWei Jia <wjia@google.com>2015-06-04 10:40:23 -0700
committerPaul Kocialkowski <contact@paulk.fr>2015-08-31 00:22:02 +0200
commita27dee19653466844fd84d88a670daf7d0cc871a (patch)
tree63eca96ea5320266d19fd3325920c1e81dfdd869
parentb5ae3d04eb49314cb6d5c7892ea4737b347e487d (diff)
downloadframeworks_av-a27dee19653466844fd84d88a670daf7d0cc871a.zip
frameworks_av-a27dee19653466844fd84d88a670daf7d0cc871a.tar.gz
frameworks_av-a27dee19653466844fd84d88a670daf7d0cc871a.tar.bz2
SampleTable: fix integer overflow checks.
Bug: 20139950 Change-Id: I6f4e3d4c734872074475d9346ed692a4baf77d79 Signed-off-by: Wei Jia <wjia@google.com> Tested-by: Moritz Bandemer <replicant@posteo.mx>
-rw-r--r--media/libstagefright/SampleTable.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/media/libstagefright/SampleTable.cpp b/media/libstagefright/SampleTable.cpp
index 2d143a1..67097c7 100644
--- a/media/libstagefright/SampleTable.cpp
+++ b/media/libstagefright/SampleTable.cpp
@@ -335,7 +335,7 @@ status_t SampleTable::setTimeToSampleParams(
}
mTimeToSampleCount = U32_AT(&header[4]);
- uint64_t allocSize = mTimeToSampleCount * 2 * (uint64_t)sizeof(uint32_t);
+ uint64_t allocSize = (uint64_t)mTimeToSampleCount * 2 * sizeof(uint32_t);
if (allocSize > SIZE_MAX) {
return ERROR_OUT_OF_RANGE;
}
@@ -384,7 +384,7 @@ status_t SampleTable::setCompositionTimeToSampleParams(
}
mNumCompositionTimeDeltaEntries = numEntries;
- uint64_t allocSize = numEntries * 2 * (uint64_t)sizeof(uint32_t);
+ uint64_t allocSize = (uint64_t)numEntries * 2 * sizeof(uint32_t);
if (allocSize > SIZE_MAX) {
return ERROR_OUT_OF_RANGE;
}