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

Unified Diff: Source/modules/crypto/SubtleCrypto.cpp

Issue 20582003: WebCrypto: Fix a crash when passing invalid ArrayBufferView to importKey. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 months 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: Source/modules/crypto/SubtleCrypto.cpp
diff --git a/Source/modules/crypto/SubtleCrypto.cpp b/Source/modules/crypto/SubtleCrypto.cpp
index 608b516c82d583ca7713606ddddbf800a78b3fd5..28a9e6d6cfcdbf5b06b8a7380f6e34c7f58ed06d 100644
--- a/Source/modules/crypto/SubtleCrypto.cpp
+++ b/Source/modules/crypto/SubtleCrypto.cpp
@@ -125,6 +125,11 @@ ScriptObject SubtleCrypto::importKey(const String& rawFormat, ArrayBufferView* k
return ScriptObject();
}
+ if (!keyData) {
+ es.throwDOMException(TypeError);
+ return ScriptObject();
+ }
+
WebKit::WebCryptoKeyUsageMask keyUsages;
if (!Key::parseUsageMask(rawKeyUsages, keyUsages)) {
es.throwDOMException(TypeError);
« LayoutTests/crypto/importKey.html ('K') | « LayoutTests/crypto/importKey-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698