Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(524)

Unified Diff: components/webcrypto/algorithms/ec.cc

Issue 2544533002: Have all overloads of webcrypto::AlgorithmImplementation::DeserializeKeyForClone check the params t… (Closed)
Patch Set: add a test for a case similar to the one the fuzzer found Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/webcrypto/algorithms/ec.cc
diff --git a/components/webcrypto/algorithms/ec.cc b/components/webcrypto/algorithms/ec.cc
index 1436ad19b57b64ccd95ed1385af568881230e5cb..2a6d312de3a65d3046511e55e53b419b2051df76 100644
--- a/components/webcrypto/algorithms/ec.cc
+++ b/components/webcrypto/algorithms/ec.cc
@@ -656,6 +656,9 @@ Status EcAlgorithm::DeserializeKeyForClone(
blink::WebCryptoKeyUsageMask usages,
const CryptoData& key_data,
blink::WebCryptoKey* key) const {
+ if (algorithm.paramsType() != blink::WebCryptoKeyAlgorithmParamsTypeEc)
+ return Status::ErrorUnexpected();
+
blink::WebCryptoAlgorithm import_algorithm =
SynthesizeImportAlgorithmForClone(algorithm);

Powered by Google App Engine
This is Rietveld 408576698