Reviewers: cbruni,

Message:
Please take a look, and CQ it if you like it.

Description:
[API] Check for NULL external data pointer in ArrayBuffer::New()

Embedders must not provide invalid pointers for external backing stores.

BUG=chromium:522128
LOG=n
[email protected]

Please review this at https://codereview.chromium.org/1289373004/

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+4, -0 lines):
  M src/api.cc


Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index f9a87397c921cc0f81b28cd4857f3f36f8b6f5ad..faea623dca204322dcb76d803448c054691d98b5 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -6559,6 +6559,8 @@ Local<ArrayBuffer> v8::ArrayBuffer::New(Isolate* isolate, size_t byte_length) {
 Local<ArrayBuffer> v8::ArrayBuffer::New(Isolate* isolate, void* data,
                                         size_t byte_length,
                                         ArrayBufferCreationMode mode) {
+  // Embedders must guarantee that the external backing store is valid.
+  CHECK(data != NULL);
   i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
   LOG_API(i_isolate, "v8::ArrayBuffer::New(void*, size_t)");
   ENTER_V8(i_isolate);
@@ -6756,6 +6758,8 @@ Local<SharedArrayBuffer> v8::SharedArrayBuffer::New(
     Isolate* isolate, void* data, size_t byte_length,
     ArrayBufferCreationMode mode) {
   CHECK(i::FLAG_harmony_sharedarraybuffer);
+  // Embedders must guarantee that the external backing store is valid.
+  CHECK(data != NULL);
   i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
   LOG_API(i_isolate, "v8::SharedArrayBuffer::New(void*, size_t)");
   ENTER_V8(i_isolate);


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to