content_decryption_fuzzer: Bug Fix

Resolved timeout issue in content_decryption_fuzzer.cpp

exec/sec: 10
Test: ./content_decryption_fuzzer clusterfuzz-testcase-minimized-content_decryption_fuzzer-6117614003748864
Bug: 3043856607

Change-Id: I5610e6bcae0bc88d5d7a31aa120adc30340b74f2
This commit is contained in:
Akshata Kadam
2023-11-06 07:56:35 +00:00
parent c1f65ff88a
commit d258c36b2f

View File

@@ -31,6 +31,7 @@ static constexpr int32_t kMaxSetId = 100;
static constexpr int32_t kMinSize = 1;
static constexpr int32_t kMaxSize = 1024;
static constexpr int32_t kMaxAppParamSize = 10;
static constexpr int32_t kMaxRuns = 100;
const std::string kSecurityLevel[] = {"QUERY_VALUE_SECURITY_LEVEL_L1",
"QUERY_VALUE_SECURITY_LEVEL_L2",
@@ -180,7 +181,11 @@ private:
void ContentDecryptionFuzzer::invokeDecryptorSessionAPIs() {
CdmKeySetId keySetId = mFdp.ConsumeRandomLengthString(kMaxByte);
while (mFdp.remaining_bytes()) {
int32_t runs = kMaxRuns;
/* Limited the while loop to prevent a timeout caused by the
/* CryptoSession constructor, which took time to initialize
/* OEMCrypto in each iteration.*/
while (mFdp.remaining_bytes() > 0 && --runs) {
auto invokeDecryptionSessionAPI =
mFdp.PickValueInArray<const std::function<void()>>({
[&]() { mDecryptor->IsOpenSession(mSessionId); },
@@ -270,7 +275,11 @@ void ContentDecryptionFuzzer::invokeDecryptorSessionAPIs() {
void ContentDecryptionFuzzer::invokeProvisionAPIs() {
while (mFdp.remaining_bytes()) {
int32_t runs = kMaxRuns;
/* Limited the while loop to prevent a timeout caused by the
/* CryptoSession constructor, which took time to initialize
/* OEMCrypto in each iteration.*/
while (mFdp.remaining_bytes() > 0 && --runs) {
auto invokeProvisionAPI =
mFdp.PickValueInArray<const std::function<void()>>({
[&]() {