[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
R=cbruni@chromium.org

Review URL: https://codereview.chromium.org/1289373004

Cr-Commit-Position: refs/heads/master@{#30243}
This commit is contained in:
jkummerow 2015-08-18 23:30:41 -07:00 committed by Commit bot
parent 9fc29357f6
commit 7fc7957be5

View File

@ -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);