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

Unified Diff: third_party/WebKit/Source/modules/crypto/Crypto.cpp

Issue 2707243006: [SharedArrayBuffer] Prevent SharedArrayBuffer being used in Web APIs (Closed)
Patch Set: update comment, add TODO Created 3 years, 8 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: third_party/WebKit/Source/modules/crypto/Crypto.cpp
diff --git a/third_party/WebKit/Source/modules/crypto/Crypto.cpp b/third_party/WebKit/Source/modules/crypto/Crypto.cpp
index 96b5e47d713f3d3bb4c974efcf1e2064a9d30d2f..0c98fdae9247ea245416f2128f4eae1356289334 100644
--- a/third_party/WebKit/Source/modules/crypto/Crypto.cpp
+++ b/third_party/WebKit/Source/modules/crypto/Crypto.cpp
@@ -50,27 +50,29 @@ bool IsIntegerArray(DOMArrayBufferView* array) {
} // namespace
-DOMArrayBufferView* Crypto::getRandomValues(DOMArrayBufferView* array,
- ExceptionState& exception_state) {
- ASSERT(array);
- if (!IsIntegerArray(array)) {
+NotShared<DOMArrayBufferView> Crypto::getRandomValues(
+ NotShared<DOMArrayBufferView> array,
+ ExceptionState& exception_state) {
+ DCHECK(array);
+ if (!IsIntegerArray(array.View())) {
exception_state.ThrowDOMException(
kTypeMismatchError,
String::Format("The provided ArrayBufferView is of type '%s', which is "
"not an integer array type.",
- array->TypeName()));
- return nullptr;
+ array.View()->TypeName()));
+ return NotShared<DOMArrayBufferView>(nullptr);
}
- if (array->byteLength() > 65536) {
+ if (array.View()->byteLength() > 65536) {
exception_state.ThrowDOMException(
kQuotaExceededError,
String::Format("The ArrayBufferView's byte length (%u) exceeds the "
"number of bytes of entropy available via this API "
"(65536).",
- array->byteLength()));
- return nullptr;
+ array.View()->byteLength()));
+ return NotShared<DOMArrayBufferView>(nullptr);
}
- CryptographicallyRandomValues(array->BaseAddress(), array->byteLength());
+ CryptographicallyRandomValues(array.View()->BaseAddress(),
+ array.View()->byteLength());
return array;
}
« no previous file with comments | « third_party/WebKit/Source/modules/crypto/Crypto.h ('k') | third_party/WebKit/Source/modules/crypto/SubtleCrypto.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698