Merge "Reject partial clear subsamples when keys are not loaded" into rvc-dev

This commit is contained in:
Rahul Frias
2020-03-28 18:24:15 +00:00
committed by Android (Google) Code Review

View File

@@ -313,8 +313,6 @@ CdmResponseType WvContentDecryptionModule::DecryptV16(
bool status =
cdm_engine->FindSessionForKey(parameters.key_id, &local_session_id);
if (!status) {
// A key does not need to be loaded if the content consists entirely of
// clear data.
bool is_any_protected = std::any_of(
std::begin(parameters.samples), std::end(parameters.samples),
[](const CdmDecryptionSample& sample) -> bool {
@@ -325,7 +323,22 @@ CdmResponseType WvContentDecryptionModule::DecryptV16(
});
});
if (is_any_protected) {
// A key does not need to be loaded if
// (a) the content consists of one or more samples and is entirely
// clear data
// (b) (legacy) the content consists of clear lead/frame in a single
// subsample. In earlier releases content was presented for decryption
// as individual subsamples. If the clear frame is broken up across
// multiple subsamples decryption, requests should be rejected
// (b/110251447)
// TODO(b/149524614): Remove support for the legacy case
if (is_any_protected ||
(parameters.observe_legacy_fields && parameters.samples.size() == 1 &&
parameters.samples[0].subsamples.size() == 1 &&
!(parameters.samples[0].subsamples[0].flags &
OEMCrypto_FirstSubsample &&
parameters.samples[0].subsamples[0].flags &
OEMCrypto_LastSubsample))) {
return KEY_NOT_FOUND_IN_SESSION;
}
}