| Index: Source/core/frame/csp/ContentSecurityPolicy.cpp
|
| diff --git a/Source/core/frame/csp/ContentSecurityPolicy.cpp b/Source/core/frame/csp/ContentSecurityPolicy.cpp
|
| index c561c3bbe00734e23f06b58c2594f3a2d6b7f17c..76e1f8d057680d7148ff24dcc8b482225120e868 100644
|
| --- a/Source/core/frame/csp/ContentSecurityPolicy.cpp
|
| +++ b/Source/core/frame/csp/ContentSecurityPolicy.cpp
|
| @@ -376,13 +376,11 @@ bool checkDigest(const String& source, uint8_t hashAlgorithmsUsed, const CSPDire
|
|
|
| StringUTF8Adaptor normalizedSource(source, StringUTF8Adaptor::Normalize, WTF::EntitiesForUnencodables);
|
|
|
| - // See comment in CSPSourceList::parseHash about why we are using this sizeof
|
| - // calculation instead of WTF_ARRAY_LENGTH.
|
| - for (size_t i = 0; i < (sizeof(kAlgorithmMap) / sizeof(kAlgorithmMap[0])); i++) {
|
| + for (const auto& algorithmMap : kAlgorithmMap) {
|
| DigestValue digest;
|
| - if (kAlgorithmMap[i].cspHashAlgorithm & hashAlgorithmsUsed) {
|
| - bool digestSuccess = computeDigest(kAlgorithmMap[i].algorithm, normalizedSource.data(), normalizedSource.length(), digest);
|
| - if (digestSuccess && isAllowedByAllWithHash<allowed>(policies, CSPHashValue(kAlgorithmMap[i].cspHashAlgorithm, digest)))
|
| + if (algorithmMap.cspHashAlgorithm & hashAlgorithmsUsed) {
|
| + bool digestSuccess = computeDigest(algorithmMap.algorithm, normalizedSource.data(), normalizedSource.length(), digest);
|
| + if (digestSuccess && isAllowedByAllWithHash<allowed>(policies, CSPHashValue(algorithmMap.cspHashAlgorithm, digest)))
|
| return true;
|
| }
|
| }
|
|
|