• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

frameworks/av


Commit MetaInfo

Revision8977f0e3aa98cbb8a6af34a429a7af5c3f8b144d (tree)
Time2015-09-29 08:27:49
AuthorJeff Tinker <jtinker@goog...>
CommiterThe Android Automerger

Log Message

Fix for security vulnerability in media server DO NOT MERGE

bug: 23540426
Change-Id: I7ca419e4008967a0387649e5293ac9d4be71d3c4

Change Summary

Incremental Difference

--- a/media/libmedia/ICrypto.cpp
+++ b/media/libmedia/ICrypto.cpp
@@ -265,7 +265,28 @@ status_t BnCrypto::onTransact(
265265 }
266266
267267 AString errorDetailMsg;
268- ssize_t result = decrypt(
268+ ssize_t result;
269+
270+ size_t sumSubsampleSizes = 0;
271+ bool overflow = false;
272+ for (int32_t i = 0; i < numSubSamples; ++i) {
273+ CryptoPlugin::SubSample &ss = subSamples[i];
274+ if (sumSubsampleSizes <= SIZE_MAX - ss.mNumBytesOfEncryptedData) {
275+ sumSubsampleSizes += ss.mNumBytesOfEncryptedData;
276+ } else {
277+ overflow = true;
278+ }
279+ if (sumSubsampleSizes <= SIZE_MAX - ss.mNumBytesOfClearData) {
280+ sumSubsampleSizes += ss.mNumBytesOfClearData;
281+ } else {
282+ overflow = true;
283+ }
284+ }
285+
286+ if (overflow || sumSubsampleSizes != totalSize) {
287+ result = -EINVAL;
288+ } else {
289+ result = decrypt(
269290 secure,
270291 key,
271292 iv,
@@ -274,6 +295,7 @@ status_t BnCrypto::onTransact(
274295 subSamples, numSubSamples,
275296 secure ? secureBufferId : dstPtr,
276297 &errorDetailMsg);
298+ }
277299
278300 reply->writeInt32(result);
279301