Bug 1937978 - Exit early with success when decrypting an empty CBCS subsample buffer with ClearKey. r=media-playback-reviewers,aosmond
Without the early exit, DecryptCbcs() will try to get the address of the first element in the subsample (Span), which with length 0 is forbidden. This could also be solved by getting the address of the Span through data() instead, to avoid dereferencing the first element. That seems more like a footgun than the early exit however. Differential Revision: https://phabricator.services.mozilla.com/D235310
This commit is contained in:
@@ -109,6 +109,11 @@ bool ClearKeyUtils::DecryptCbcs(const vector<uint8_t>& aKey,
|
||||
return false;
|
||||
}
|
||||
|
||||
if (aSubsample.Length() == 0) {
|
||||
// Nothing to decrypt.
|
||||
return true;
|
||||
}
|
||||
|
||||
std::unique_ptr<PK11SlotInfo, MaybeDeleteHelper<PK11SlotInfo>> slot(
|
||||
PK11_GetInternalKeySlot());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user