summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAli Ijaz Sheikh <ofrobots@google.com>2017-03-20 10:04:48 -0700
committerMyles Borins <mylesborins@google.com>2017-04-18 20:08:38 -0400
commitab3fdf531fe0536ae6b3a657d7fb73adc0881a99 (patch)
treec672d870175564da4215fdf66a7b8f5450faaaa2
parent54f5258582402644c35693d6fe2bd0a9933b0305 (diff)
downloadnode-new-ab3fdf531fe0536ae6b3a657d7fb73adc0881a99.tar.gz
deps: cherry-pick ca0f9573 from V8 upstream
Original commit message: Trigger OOM crash if no memory returned in v8::ArrayBuffer::New and v… …8::SharedArrayBuffer::New. This API does not allow reporting failure, but we should crash rather than have the caller get an ArrayBuffer that isn't properly set up. BUG=chromium:681843 Review-Url: https://codereview.chromium.org/2641953002 Cr-Commit-Position: refs/heads/master@{#42511} PR-URL: https://github.com/nodejs/node/pull/11940 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
-rw-r--r--deps/v8/include/v8-version.h2
-rw-r--r--deps/v8/src/api.cc14
2 files changed, 12 insertions, 4 deletions
diff --git a/deps/v8/include/v8-version.h b/deps/v8/include/v8-version.h
index fc3292b05f..2101944d14 100644
--- a/deps/v8/include/v8-version.h
+++ b/deps/v8/include/v8-version.h
@@ -11,7 +11,7 @@
#define V8_MAJOR_VERSION 4
#define V8_MINOR_VERSION 5
#define V8_BUILD_NUMBER 103
-#define V8_PATCH_LEVEL 46
+#define V8_PATCH_LEVEL 47
// Use 1 for candidates and 0 otherwise.
// (Boolean macro values are not supported by all preprocessors.)
diff --git a/deps/v8/src/api.cc b/deps/v8/src/api.cc
index ec0f805876..594d2ebcf2 100644
--- a/deps/v8/src/api.cc
+++ b/deps/v8/src/api.cc
@@ -6580,7 +6580,11 @@ Local<ArrayBuffer> v8::ArrayBuffer::New(Isolate* isolate, size_t byte_length) {
ENTER_V8(i_isolate);
i::Handle<i::JSArrayBuffer> obj =
i_isolate->factory()->NewJSArrayBuffer(i::SharedFlag::kNotShared);
- i::Runtime::SetupArrayBufferAllocatingData(i_isolate, obj, byte_length);
+ // TODO(jbroman): It may be useful in the future to provide a MaybeLocal
+ // version that throws an exception or otherwise does not crash.
+ if (!i::Runtime::SetupArrayBufferAllocatingData(i_isolate, obj, byte_length)) {
+ i::FatalProcessOutOfMemory("v8::ArrayBuffer::New");
+ }
return Utils::ToLocal(obj);
}
@@ -6775,8 +6779,12 @@ Local<SharedArrayBuffer> v8::SharedArrayBuffer::New(Isolate* isolate,
ENTER_V8(i_isolate);
i::Handle<i::JSArrayBuffer> obj =
i_isolate->factory()->NewJSArrayBuffer(i::SharedFlag::kShared);
- i::Runtime::SetupArrayBufferAllocatingData(i_isolate, obj, byte_length, true,
- i::SharedFlag::kShared);
+ // TODO(jborman): It may be useful in the future to provide a MaybeLocal
+ // version that throws an exception or otherwise does not crash.
+ if (!i::Runtime::SetupArrayBufferAllocatingData(i_isolate, obj, byte_length, true,
+ i::SharedFlag::kShared)) {
+ i::FatalProcessOutOfMemory("v8::SharedArrayBuffer::New");
+ }
return Utils::ToLocalShared(obj);
}