summaryrefslogtreecommitdiffstats
path: root/media/libmediaplayerservice
diff options
context:
space:
mode:
authorPatrik2 Carlsson <patrik2.carlsson@sonymobile.com>2015-05-25 15:12:49 +0200
committerSteve Kondik <steve@cyngn.com>2016-03-22 17:14:35 -0700
commit536fd16fa6d56008ba3d6f46275fd52dac25fd8c (patch)
treeaec5ee300cc4b9025f32784db2e9ceff7c965a42 /media/libmediaplayerservice
parent5a4c1f8f409a28508075562277e4d19c4650513c (diff)
downloadframeworks_av-536fd16fa6d56008ba3d6f46275fd52dac25fd8c.zip
frameworks_av-536fd16fa6d56008ba3d6f46275fd52dac25fd8c.tar.gz
frameworks_av-536fd16fa6d56008ba3d6f46275fd52dac25fd8c.tar.bz2
Avoid parsing CC SEI payload beyond buffer end
Break CC SEI parsing when payload size exceeds buffer size to avoid a CHECK that have been seen in MTBF statistics. Change-Id: Ifd97648678a935ac815dd616301d46f9bf583838
Diffstat (limited to 'media/libmediaplayerservice')
-rw-r--r--media/libmediaplayerservice/nuplayer/NuPlayerCCDecoder.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayerCCDecoder.cpp b/media/libmediaplayerservice/nuplayer/NuPlayerCCDecoder.cpp
index ac3c6b6..2c07f28 100644
--- a/media/libmediaplayerservice/nuplayer/NuPlayerCCDecoder.cpp
+++ b/media/libmediaplayerservice/nuplayer/NuPlayerCCDecoder.cpp
@@ -235,6 +235,12 @@ bool NuPlayer::CCDecoder::parseSEINalUnit(
payload_size += last_byte;
} while (last_byte == 0xFF);
+ if (payload_size > SIZE_MAX / 8
+ || !br.atLeastNumBitsLeft(payload_size * 8)) {
+ ALOGV("Malformed SEI payload");
+ break;
+ }
+
// sei_payload()
if (payload_type == 4) {
bool isCC = false;