Merge pull request #9930 from sfc-gh-ahusain/ahusain-fdbcore-4473

Fix Asan reporting heap overflow
This commit is contained in:
A.J. Beamon 2023-04-07 11:36:54 -07:00 committed by GitHub
commit 9372e6a8c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 4 deletions

View File

@ -1910,10 +1910,9 @@ void testKeyCacheEssentials(DomainKeyMap& domainKeyMap,
Reference<BaseCipher> baseCipher = domainKeyMap[minDomainId][minBaseCipherKeyId];
uint8_t rawCipher[baseCipher->len];
memcpy(rawCipher, baseCipher->key.get(), baseCipher->len);
// modify few bytes in the cipherKey
for (int i = 2; i < 5; i++) {
rawCipher[i]++;
}
// modify cipherKey by flipping a bit
const int idx = deterministicRandom()->randomInt(0, baseCipher->len);
rawCipher[idx]++;
cipherKeyCache->insertCipherKey(baseCipher->domainId,
baseCipher->keyId,
&rawCipher[0],