From 1003f4c97531cd3e44c635da83d0cbe7be8d6048 Mon Sep 17 00:00:00 2001 From: Refael Ackermann Date: Sun, 21 Oct 2018 09:04:43 -0400 Subject: [PATCH 1/4] deps: fix wrong default for v8 handle zapping MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/23801 Fixes: https://github.com/nodejs/node/issues/23796 Reviewed-By: Anna Henningsen Reviewed-By: Michaël Zasso Reviewed-By: Matheus Marchini --- common.gypi | 2 +- deps/v8/gypfiles/features.gypi | 11 +++++++---- deps/v8/gypfiles/toolchain.gypi | 6 ++++++ 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/common.gypi b/common.gypi index c235f07712c74f..14c6b5ae9f8463 100644 --- a/common.gypi +++ b/common.gypi @@ -33,7 +33,7 @@ # Reset this number to 0 on major V8 upgrades. # Increment by one for each non-official patch applied to deps/v8. - 'v8_embedder_string': '-node.35', + 'v8_embedder_string': '-node.36', # Enable disassembler for `--print-code` v8 options 'v8_enable_disassembler': 1, diff --git a/deps/v8/gypfiles/features.gypi b/deps/v8/gypfiles/features.gypi index 35a078e8af2fd2..618949124a71cb 100644 --- a/deps/v8/gypfiles/features.gypi +++ b/deps/v8/gypfiles/features.gypi @@ -103,7 +103,9 @@ # Enable mitigations for executing untrusted code. 'v8_untrusted_code_mitigations%': 'true', - 'v8_enable_handle_zapping%': 1, + # Currently set for node by common.gypi, avoiding default because of gyp file bug. + # Should be turned on only for debugging. + #'v8_enable_handle_zapping%': 0, }, 'target_defaults': { 'conditions': [ @@ -164,9 +166,10 @@ ['v8_untrusted_code_mitigations=="false"', { 'defines': ['DISABLE_UNTRUSTED_CODE_MITIGATIONS',], }], - ['v8_enable_handle_zapping==1', { - 'defines': ['ENABLE_HANDLE_ZAPPING',], - }], + # Refs: https://github.com/nodejs/node/pull/23801 + # ['v8_enable_handle_zapping==1', { + # 'defines': ['ENABLE_HANDLE_ZAPPING',], + # }], ], # conditions 'defines': [ 'V8_GYP_BUILD', diff --git a/deps/v8/gypfiles/toolchain.gypi b/deps/v8/gypfiles/toolchain.gypi index 7f497fac91e2b2..ea8f1c2f00da56 100644 --- a/deps/v8/gypfiles/toolchain.gypi +++ b/deps/v8/gypfiles/toolchain.gypi @@ -1321,6 +1321,10 @@ }, { 'inherit_from': ['DebugBase1'], }], + # Temporary refs: https://github.com/nodejs/node/pull/23801 + ['v8_enable_handle_zapping==1', { + 'defines': ['ENABLE_HANDLE_ZAPPING',], + }], ], }, # Debug 'ReleaseBase': { @@ -1405,6 +1409,8 @@ }, # Release 'Release': { 'inherit_from': ['ReleaseBase'], + # Temporary refs: https://github.com/nodejs/node/pull/23801 + 'defines!': ['ENABLE_HANDLE_ZAPPING',], }, # Debug 'conditions': [ [ 'OS=="win"', { From 2cd68be69d7a60e8b419085e42a0cf7bfcd6ea2f Mon Sep 17 00:00:00 2001 From: Refael Ackermann Date: Thu, 18 Oct 2018 11:00:11 -0400 Subject: [PATCH 2/4] build: spawn `make test-ci` with `-j1` All the sub targets have internal parallelism, so no performance loss. Also `make` doesn't to a good enough job of combining the output streams, or eliminate races. PR-URL: https://github.com/nodejs/node/pull/23733 Fixes: https://github.com/nodejs/node/issues/22006 Reviewed-By: Richard Lau Reviewed-By: Joyee Cheung Reviewed-By: Matheus Marchini --- Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 05d3056f27973e..a98772faea6dca 100644 --- a/Makefile +++ b/Makefile @@ -480,8 +480,11 @@ build-ci: # of tests. See `test-ci-native` and `test-ci-js`. # - node-test-commit-linux-coverage: where the build and the tests need # to be instrumented, see `coverage`. +# +# Using -j1 as the sub target in `test-ci` already have internal parallelism. +# Refs: https://github.com/nodejs/node/pull/23733 run-ci: build-ci - $(MAKE) test-ci + $(MAKE) test-ci -j1 test-release: test-build $(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) From 2ba60100820afe9b01f0d3dcee46453ce26db7e0 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Sun, 21 Oct 2018 06:44:48 +0200 Subject: [PATCH 3/4] buffer: fix crash for invalid index types 2555cb4a4049dc4c41d8a2f4ce50909cc0a12a4a introduced a crash when a non-number value was passed to `ParseArrayIndex()`. We do not always have JS typechecking for that in place, though. This returns back to the previous behavior of coercing values to integers, which is certainly questionable. Refs: https://github.com/nodejs/node/pull/22129 Fixes: https://github.com/nodejs/node/issues/23668 --- src/node_buffer.cc | 62 ++++++++++++++++++------------- test/parallel/test-buffer-copy.js | 26 +++++++++++++ 2 files changed, 62 insertions(+), 26 deletions(-) diff --git a/src/node_buffer.cc b/src/node_buffer.cc index 8642477db4d927..bf79e66cb19b5d 100644 --- a/src/node_buffer.cc +++ b/src/node_buffer.cc @@ -40,16 +40,18 @@ #define THROW_AND_RETURN_IF_OOB(r) \ do { \ - if (!(r)) return node::THROW_ERR_INDEX_OUT_OF_RANGE(env); \ - } while (0) + if ((r).IsNothing()) return; \ + if (!(r).FromJust()) \ + return node::THROW_ERR_INDEX_OUT_OF_RANGE(env); \ + } while (0) \ -#define SLICE_START_END(start_arg, end_arg, end_max) \ +#define SLICE_START_END(env, start_arg, end_arg, end_max) \ size_t start; \ size_t end; \ - THROW_AND_RETURN_IF_OOB(ParseArrayIndex(start_arg, 0, &start)); \ - THROW_AND_RETURN_IF_OOB(ParseArrayIndex(end_arg, end_max, &end)); \ + THROW_AND_RETURN_IF_OOB(ParseArrayIndex(env, start_arg, 0, &start)); \ + THROW_AND_RETURN_IF_OOB(ParseArrayIndex(env, end_arg, end_max, &end)); \ if (end < start) end = start; \ - THROW_AND_RETURN_IF_OOB(end <= end_max); \ + THROW_AND_RETURN_IF_OOB(Just(end <= end_max)); \ size_t length = end - start; namespace node { @@ -76,9 +78,11 @@ using v8::EscapableHandleScope; using v8::FunctionCallbackInfo; using v8::Integer; using v8::Isolate; +using v8::Just; using v8::Local; using v8::Maybe; using v8::MaybeLocal; +using v8::Nothing; using v8::Object; using v8::String; using v8::Uint32; @@ -161,29 +165,32 @@ void CallbackInfo::WeakCallback(Isolate* isolate) { } -// Parse index for external array data. -inline MUST_USE_RESULT bool ParseArrayIndex(Local arg, - size_t def, - size_t* ret) { +// Parse index for external array data. An empty Maybe indicates +// a pending exception. `false` indicates that the index is out-of-bounds. +inline MUST_USE_RESULT Maybe ParseArrayIndex(Environment* env, + Local arg, + size_t def, + size_t* ret) { if (arg->IsUndefined()) { *ret = def; - return true; + return Just(true); } - CHECK(arg->IsNumber()); - int64_t tmp_i = arg.As()->Value(); + int64_t tmp_i; + if (!arg->IntegerValue(env->context()).To(&tmp_i)) + return Nothing(); if (tmp_i < 0) - return false; + return Just(false); // Check that the result fits in a size_t. const uint64_t kSizeMax = static_cast(static_cast(-1)); // coverity[pointless_expression] if (static_cast(tmp_i) > kSizeMax) - return false; + return Just(false); *ret = static_cast(tmp_i); - return true; + return Just(true); } } // anonymous namespace @@ -452,7 +459,7 @@ void StringSlice(const FunctionCallbackInfo& args) { if (ts_obj_length == 0) return args.GetReturnValue().SetEmptyString(); - SLICE_START_END(args[0], args[1], ts_obj_length) + SLICE_START_END(env, args[0], args[1], ts_obj_length) Local error; MaybeLocal ret = @@ -485,9 +492,10 @@ void Copy(const FunctionCallbackInfo &args) { size_t source_start; size_t source_end; - THROW_AND_RETURN_IF_OOB(ParseArrayIndex(args[2], 0, &target_start)); - THROW_AND_RETURN_IF_OOB(ParseArrayIndex(args[3], 0, &source_start)); - THROW_AND_RETURN_IF_OOB(ParseArrayIndex(args[4], ts_obj_length, &source_end)); + THROW_AND_RETURN_IF_OOB(ParseArrayIndex(env, args[2], 0, &target_start)); + THROW_AND_RETURN_IF_OOB(ParseArrayIndex(env, args[3], 0, &source_start)); + THROW_AND_RETURN_IF_OOB(ParseArrayIndex(env, args[4], ts_obj_length, + &source_end)); // Copy 0 bytes; we're done if (target_start >= target_length || source_start >= source_end) @@ -617,13 +625,13 @@ void StringWrite(const FunctionCallbackInfo& args) { size_t offset; size_t max_length; - THROW_AND_RETURN_IF_OOB(ParseArrayIndex(args[1], 0, &offset)); + THROW_AND_RETURN_IF_OOB(ParseArrayIndex(env, args[1], 0, &offset)); if (offset > ts_obj_length) { return node::THROW_ERR_BUFFER_OUT_OF_BOUNDS( env, "\"offset\" is outside of buffer bounds"); } - THROW_AND_RETURN_IF_OOB(ParseArrayIndex(args[2], ts_obj_length - offset, + THROW_AND_RETURN_IF_OOB(ParseArrayIndex(env, args[2], ts_obj_length - offset, &max_length)); max_length = MIN(ts_obj_length - offset, max_length); @@ -678,10 +686,12 @@ void CompareOffset(const FunctionCallbackInfo &args) { size_t source_end; size_t target_end; - THROW_AND_RETURN_IF_OOB(ParseArrayIndex(args[2], 0, &target_start)); - THROW_AND_RETURN_IF_OOB(ParseArrayIndex(args[3], 0, &source_start)); - THROW_AND_RETURN_IF_OOB(ParseArrayIndex(args[4], target_length, &target_end)); - THROW_AND_RETURN_IF_OOB(ParseArrayIndex(args[5], ts_obj_length, &source_end)); + THROW_AND_RETURN_IF_OOB(ParseArrayIndex(env, args[2], 0, &target_start)); + THROW_AND_RETURN_IF_OOB(ParseArrayIndex(env, args[3], 0, &source_start)); + THROW_AND_RETURN_IF_OOB(ParseArrayIndex(env, args[4], target_length, + &target_end)); + THROW_AND_RETURN_IF_OOB(ParseArrayIndex(env, args[5], ts_obj_length, + &source_end)); if (source_start > ts_obj_length) return node::THROW_ERR_INDEX_OUT_OF_RANGE(env); diff --git a/test/parallel/test-buffer-copy.js b/test/parallel/test-buffer-copy.js index 8ede5101463b05..f3c351f09aead3 100644 --- a/test/parallel/test-buffer-copy.js +++ b/test/parallel/test-buffer-copy.js @@ -18,6 +18,17 @@ let cntr = 0; } } +{ + // Current behavior is to coerce values to integers. + b.fill(++cntr); + c.fill(++cntr); + const copied = b.copy(c, '0', '0', '512'); + assert.strictEqual(copied, 512); + for (let i = 0; i < c.length; i++) { + assert.strictEqual(c[i], b[i]); + } +} + { // copy c into b, without specifying sourceEnd b.fill(++cntr); @@ -144,3 +155,18 @@ assert.strictEqual(b.copy(c, 512, 0, 10), 0); assert.strictEqual(c[i], e[i]); } } + +// https://github.com/nodejs/node/issues/23668: Do not crash for invalid input. +c.fill('c'); +b.copy(c, 'not a valid offset'); +// Make sure this acted like a regular copy with `0` offset. +assert.deepStrictEqual(c, b.slice(0, c.length)); + +{ + c.fill('C'); + assert.throws(() => { + b.copy(c, { [Symbol.toPrimitive]() { throw new Error('foo'); } }); + }, /foo/); + // No copying took place: + assert.deepStrictEqual(c.toString(), 'C'.repeat(c.length)); +} From ab4af087e83d91a46354d765306d3543b1d85423 Mon Sep 17 00:00:00 2001 From: Myles Borins Date: Tue, 23 Oct 2018 10:16:47 -0400 Subject: [PATCH 4/4] 2018-10-30 Version 10.13.0 'Dubnium' (LTS) This release marks the transition of Node.js 10.x into Long Term Support (LTS) with the codename 'Dubnium'. The 10.x release line now moves in to "Active LTS" and will remain so until April 2020. After that time it will move in to "Maintenance" until end of life in April 2021. Notable Changes: This release only includes minimal changes necessary to fix known regressions prior to LTS. PR-URL: https://github.com/nodejs/node/pull/23831 --- CHANGELOG.md | 7 ++++--- doc/changelogs/CHANGELOG_V10.md | 20 ++++++++++++++++++++ src/node_version.h | 10 +++++----- test/parallel/test-process-release.js | 2 ++ 4 files changed, 31 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a0064c09fe77b3..ab99af5f92621a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,9 +8,9 @@ release lines. Select a Node.js version below to view the changelog history: -* [Node.js 10](doc/changelogs/CHANGELOG_V10.md) — **Current** +* [Node.js 10](doc/changelogs/CHANGELOG_V10.md) — **Long Term Support** * [Node.js 9](doc/changelogs/CHANGELOG_V9.md) — End-of-Life -* [Node.js 8](doc/changelogs/CHANGELOG_V8.md) — **Long Term Support** +* [Node.js 8](doc/changelogs/CHANGELOG_V8.md) — Long Term Support * [Node.js 7](doc/changelogs/CHANGELOG_V7.md) — End-of-Life * [Node.js 6](doc/changelogs/CHANGELOG_V6.md) — Long Term Support * [Node.js 5](doc/changelogs/CHANGELOG_V5.md) — End-of-Life @@ -31,7 +31,8 @@ release. -10.12.0
+10.13.0
+10.12.0
10.11.0
10.10.0
10.9.0
diff --git a/doc/changelogs/CHANGELOG_V10.md b/doc/changelogs/CHANGELOG_V10.md index 5b69c7c4e52a64..244247586955b2 100644 --- a/doc/changelogs/CHANGELOG_V10.md +++ b/doc/changelogs/CHANGELOG_V10.md @@ -9,6 +9,7 @@ +10.13.0
10.12.0
10.11.0
10.10.0
@@ -40,6 +41,25 @@ * [io.js](CHANGELOG_IOJS.md) * [Archive](CHANGELOG_ARCHIVE.md) + +## 2018-10-30, Version 10.13.0 'Dubnium' (LTS), @MylesBorins + +This release marks the transition of Node.js 10.x into Long Term +Support (LTS) with the codename 'Dubnium'. The 10.x release line +now moves in to "Active LTS" and will remain so until April 2020. +After that time it will move in to "Maintenance" until end of +life in April 2021. + +### Notable Changes + +This release only includes minimal changes necessary to fix known regressions prior to LTS. + +### Commits + +* [[`2ba6010082`](https://github.com/nodejs/node/commit/2ba6010082)] - **buffer**: fix crash for invalid index types (Anna Henningsen) +* [[`2cd68be69d`](https://github.com/nodejs/node/commit/2cd68be69d)] - **build**: spawn `make test-ci` with `-j1` (Refael Ackermann) [#23733](https://github.com/nodejs/node/pull/23733) +* [[`1003f4c975`](https://github.com/nodejs/node/commit/1003f4c975)] - **deps**: fix wrong default for v8 handle zapping (Refael Ackermann) [#23801](https://github.com/nodejs/node/pull/23801) + ## 2018-10-10, Version 10.12.0 (Current), @targos diff --git a/src/node_version.h b/src/node_version.h index 5b8f941fcb3879..7e7b31f8bc7859 100644 --- a/src/node_version.h +++ b/src/node_version.h @@ -23,13 +23,13 @@ #define SRC_NODE_VERSION_H_ #define NODE_MAJOR_VERSION 10 -#define NODE_MINOR_VERSION 12 -#define NODE_PATCH_VERSION 1 +#define NODE_MINOR_VERSION 13 +#define NODE_PATCH_VERSION 0 -#define NODE_VERSION_IS_LTS 0 -#define NODE_VERSION_LTS_CODENAME "" +#define NODE_VERSION_IS_LTS 1 +#define NODE_VERSION_LTS_CODENAME "Dubnium" -#define NODE_VERSION_IS_RELEASE 0 +#define NODE_VERSION_IS_RELEASE 1 #ifndef NODE_STRINGIFY #define NODE_STRINGIFY(n) NODE_STRINGIFY_HELPER(n) diff --git a/test/parallel/test-process-release.js b/test/parallel/test-process-release.js index 8b6bca9141beed..019903d09322a4 100644 --- a/test/parallel/test-process-release.js +++ b/test/parallel/test-process-release.js @@ -15,6 +15,8 @@ if (versionParts[0] === '4' && versionParts[1] >= 2) { assert.strictEqual(process.release.lts, 'Boron'); } else if (versionParts[0] === '8' && versionParts[1] >= 9) { assert.strictEqual(process.release.lts, 'Carbon'); +} else if (versionParts[0] === '10' && versionParts[1] >= 13) { + assert.strictEqual(process.release.lts, 'Dubnium'); } else { assert.strictEqual(process.release.lts, undefined); }