From 820ae61c12b12ceca23d96a30e1bbe8e601bc735 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Sun, 24 Feb 2019 22:05:44 +0100 Subject: src: forbid handle allocations from Platform tasks Platform tasks should have their own handle scopes, rather than leak into outer ones. PR-URL: https://github.com/nodejs/node/pull/26376 Reviewed-By: Gireesh Punathil Reviewed-By: Ben Noordhuis Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- src/node_platform.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/node_platform.cc') diff --git a/src/node_platform.cc b/src/node_platform.cc index 9b1c4b4ca9..115b59e356 100644 --- a/src/node_platform.cc +++ b/src/node_platform.cc @@ -8,11 +8,11 @@ namespace node { -using v8::HandleScope; using v8::Isolate; using v8::Local; using v8::Object; using v8::Platform; +using v8::SealHandleScope; using v8::Task; using node::tracing::TracingController; @@ -332,7 +332,9 @@ int NodePlatform::NumberOfWorkerThreads() { void PerIsolatePlatformData::RunForegroundTask(std::unique_ptr task) { Isolate* isolate = Isolate::GetCurrent(); - HandleScope scope(isolate); +#ifdef DEBUG + SealHandleScope scope(isolate); +#endif Environment* env = Environment::GetCurrent(isolate); if (env != nullptr) { InternalCallbackScope cb_scope(env, Local(), { 0, 0 }, -- cgit v1.2.3