chore: bump node to v16.11.1 (main) (#31369)

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
This commit is contained in:
electron-roller[bot] 2021-10-14 09:43:48 +02:00 коммит произвёл GitHub
Родитель bc3198ed81
Коммит 6c5fbe3566
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
13 изменённых файлов: 102 добавлений и 75 удалений

2
DEPS
Просмотреть файл

@ -17,7 +17,7 @@ vars = {
'chromium_version':
'96.0.4647.0',
'node_version':
'v16.10.0',
'v16.11.1',
'nan_version':
# The following commit hash of NAN is v2.14.2 with *only* changes to the
# test suite. This should be updated to a specific tag when one becomes

Просмотреть файл

@ -22,4 +22,4 @@ fix_account_for_debugger_agent_race_condition.patch
add_should_read_node_options_from_env_option_to_disable_node_options.patch
repl_fix_crash_when_sharedarraybuffer_disabled.patch
fix_readbarrier_undefined_symbol_error_on_woa_arm64.patch
fix_crash_creating_private_key_with_unsupported_algorithm.patch
chore_fix_-wimplicit-fallthrough.patch

Просмотреть файл

@ -21,7 +21,7 @@ index 1cc7da1ce15f43905ce607adcc1a23ed9d92948a..16af6aec3791df1363682f1ed024c522
Isolate* isolate,
const std::vector<std::string>& args,
diff --git a/src/env.h b/src/env.h
index d31512ae37fba212a20cf306be46f7dfadeabd6a..8286ea06cc5c4e836921b06b37cf19d4508f4832 100644
index e0deca497feb111622b257b952c9ed9161c7d001..ab8334bf0e3405fee4d21a4b541bd1164d92ca89 100644
--- a/src/env.h
+++ b/src/env.h
@@ -1145,6 +1145,8 @@ class Environment : public MemoryRetainer {

Просмотреть файл

@ -669,10 +669,10 @@ index 0000000000000000000000000000000000000000..fb000f8ee7647c375bc190d1729d67bb
+}
diff --git a/deps/nghttp2/BUILD.gn b/deps/nghttp2/BUILD.gn
new file mode 100644
index 0000000000000000000000000000000000000000..e90a1416f5b0106e5886564061d48f32b730b1c2
index 0000000000000000000000000000000000000000..b7a9daa0d099be8ce1b594cd5128e54ab88d1f25
--- /dev/null
+++ b/deps/nghttp2/BUILD.gn
@@ -0,0 +1,49 @@
@@ -0,0 +1,48 @@
+config("nghttp2_config") {
+ defines = [ "NGHTTP2_STATICLIB" ]
+ include_dirs = [ "lib/includes" ]
@ -706,7 +706,6 @@ index 0000000000000000000000000000000000000000..e90a1416f5b0106e5886564061d48f32
+ "lib/nghttp2_hd_huffman_data.c",
+ "lib/nghttp2_helper.c",
+ "lib/nghttp2_http.c",
+ "lib/nghttp2_ksl.c",
+ "lib/nghttp2_map.c",
+ "lib/nghttp2_mem.c",
+ "lib/nghttp2_npn.c",
@ -1781,7 +1780,7 @@ index 0000000000000000000000000000000000000000..d1d6b51e8c0c5bc6a5d09e217eb30483
+ args = rebase_path(inputs + outputs, root_build_dir)
+}
diff --git a/src/node_version.h b/src/node_version.h
index a572d9b95853730a29a67349b46d47d6180586f3..888a95f93411a9168b75751e0af12c74fc5f0ba9 100644
index 119a341d8dc5bc11c3f0db69d489ae60f4a33923..938ca353d332b3ca599b19cdc763c93a98eb8854 100644
--- a/src/node_version.h
+++ b/src/node_version.h
@@ -89,7 +89,10 @@

Просмотреть файл

@ -0,0 +1,76 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shelley Vohr <shelley.vohr@gmail.com>
Date: Mon, 11 Oct 2021 13:46:24 +0200
Subject: chore: fix -Wimplicit-fallthrough
Upstreamed at https://github.com/nghttp2/nghttp2/pull/1626.
diff --git a/deps/nghttp2/BUILD.gn b/deps/nghttp2/BUILD.gn
index b7a9daa0d099be8ce1b594cd5128e54ab88d1f25..3872f5fd74f9ae569bf5043b33ff4b52e58f7341 100644
--- a/deps/nghttp2/BUILD.gn
+++ b/deps/nghttp2/BUILD.gn
@@ -16,7 +16,6 @@ static_library("nghttp2") {
cflags_c = [
"-Wno-implicit-function-declaration",
- "-Wno-implicit-fallthrough",
"-Wno-string-plus-int",
"-Wno-unreachable-code-return",
]
diff --git a/deps/nghttp2/lib/nghttp2_hd.c b/deps/nghttp2/lib/nghttp2_hd.c
index 5e8693152599215261e47b152d565bbd9a0083e7..6d54e91dea6d77ad8925ad0452fd2a0a36f35f73 100644
--- a/deps/nghttp2/lib/nghttp2_hd.c
+++ b/deps/nghttp2/lib/nghttp2_hd.c
@@ -1891,7 +1891,7 @@ ssize_t nghttp2_hd_inflate_hd_nv(nghttp2_hd_inflater *inflater,
rv = NGHTTP2_ERR_HEADER_COMP;
goto fail;
}
- /* fall through */
+ __attribute__((fallthrough));
case NGHTTP2_HD_STATE_INFLATE_START:
case NGHTTP2_HD_STATE_OPCODE:
if ((*in & 0xe0u) == 0x20u) {
@@ -2001,7 +2001,7 @@ ssize_t nghttp2_hd_inflate_hd_nv(nghttp2_hd_inflater *inflater,
inflater->left = 0;
inflater->shift = 0;
DEBUGF("inflatehd: huffman encoded=%d\n", inflater->huffman_encoded != 0);
- /* Fall through */
+ __attribute__((fallthrough));
case NGHTTP2_HD_STATE_NEWNAME_READ_NAMELEN:
rfin = 0;
rv = hd_inflate_read_len(inflater, &rfin, in, last, 7, NGHTTP2_HD_MAX_NV);
@@ -2085,7 +2085,7 @@ ssize_t nghttp2_hd_inflate_hd_nv(nghttp2_hd_inflater *inflater,
inflater->left = 0;
inflater->shift = 0;
DEBUGF("inflatehd: huffman encoded=%d\n", inflater->huffman_encoded != 0);
- /* Fall through */
+ __attribute__((fallthrough));
case NGHTTP2_HD_STATE_READ_VALUELEN:
rfin = 0;
rv = hd_inflate_read_len(inflater, &rfin, in, last, 7, NGHTTP2_HD_MAX_NV);
diff --git a/deps/nghttp2/lib/nghttp2_session.c b/deps/nghttp2/lib/nghttp2_session.c
index 36f1179f72a22595dda0b98927d87e2098cad4df..f007dbf410b1bdc5d1f603aa85c3a4f0704e9741 100644
--- a/deps/nghttp2/lib/nghttp2_session.c
+++ b/deps/nghttp2/lib/nghttp2_session.c
@@ -2644,10 +2644,10 @@ static int session_after_frame_sent1(nghttp2_session *session) {
case NGHTTP2_HCAT_PUSH_RESPONSE:
stream->flags = (uint8_t)(stream->flags & ~NGHTTP2_STREAM_FLAG_PUSH);
++session->num_outgoing_streams;
- /* Fall through */
+ __attribute__((fallthrough));
case NGHTTP2_HCAT_RESPONSE:
stream->state = NGHTTP2_STREAM_OPENED;
- /* Fall through */
+ __attribute__((fallthrough));
case NGHTTP2_HCAT_HEADERS:
if (frame->hd.flags & NGHTTP2_FLAG_END_STREAM) {
nghttp2_stream_shutdown(stream, NGHTTP2_SHUT_WR);
@@ -5456,7 +5456,7 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in,
iframe->state = NGHTTP2_IB_READ_HEAD;
- /* Fall through */
+ __attribute__((fallthrough));
case NGHTTP2_IB_READ_HEAD: {
int on_begin_frame_called = 0;

Просмотреть файл

@ -8,7 +8,7 @@ node modules will have different (wrong) ideas about how v8 structs are laid
out in memory on 64-bit machines, and will summarily fail to work.
diff --git a/common.gypi b/common.gypi
index c222ed20be858544d454c59192889132eaa9e1ee..4f352dea639cc9ab8913b915d35df4edf4fb6a06 100644
index 506d91edaa1dc1ffbcad7986d05c9e667c296a8e..caf0aa630892297b2751f44b44ae68974ece900e 100644
--- a/common.gypi
+++ b/common.gypi
@@ -64,7 +64,7 @@

Просмотреть файл

@ -7,7 +7,7 @@ common.gypi is a file that's included in the node header bundle, despite
the fact that we do not build node with gyp.
diff --git a/common.gypi b/common.gypi
index 7bc2b3abf470193640b40824ffb17891088cabfb..c222ed20be858544d454c59192889132eaa9e1ee 100644
index 6862acc20b31c5bd819159911c0f3d4a2e42a0c1..506d91edaa1dc1ffbcad7986d05c9e667c296a8e 100644
--- a/common.gypi
+++ b/common.gypi
@@ -81,6 +81,23 @@

Просмотреть файл

@ -6,7 +6,7 @@ Subject: fix: add v8_enable_reverse_jsargs defines in common.gypi
This can be removed once node upgrades V8 and inevitably has to do this exact same thing. Also hi node people if you are looking at this.
diff --git a/common.gypi b/common.gypi
index 4f352dea639cc9ab8913b915d35df4edf4fb6a06..63c7d2b1da5f1c83f02f856e0d14198bfed6787e 100644
index caf0aa630892297b2751f44b44ae68974ece900e..8a85c7c3d0ab0e2906c417f2cc2fc9ca584fd601 100644
--- a/common.gypi
+++ b/common.gypi
@@ -65,6 +65,7 @@

Просмотреть файл

@ -36,10 +36,10 @@ index 523d252e08974a10f9a53fb46d3345669cec3380..5bf19a0dda42849159d954181058897c
#endif
diff --git a/src/env-inl.h b/src/env-inl.h
index 2b000ed9ace5f73bfe0e8cab3e83ce94804f9c55..a1690712c457534d70db777cb722537913f86a0e 100644
index 1e85bc07a4cc29f3b380da3c0e217a85309eb3a5..845e00208af4b12960ed8b3f3926323af7685185 100644
--- a/src/env-inl.h
+++ b/src/env-inl.h
@@ -891,6 +891,10 @@ inline bool Environment::no_global_search_paths() const {
@@ -892,6 +892,10 @@ inline bool Environment::no_global_search_paths() const {
!options_->global_search_paths;
}
@ -51,7 +51,7 @@ index 2b000ed9ace5f73bfe0e8cab3e83ce94804f9c55..a1690712c457534d70db777cb7225379
return emit_filehandle_warning_;
}
diff --git a/src/env.h b/src/env.h
index f055e6b45013d9f8c039c662981bfd54f08266f6..d31512ae37fba212a20cf306be46f7dfadeabd6a 100644
index 0c3715151488f425a723618252e1277b78fafe5f..e0deca497feb111622b257b952c9ed9161c7d001 100644
--- a/src/env.h
+++ b/src/env.h
@@ -1204,6 +1204,7 @@ class Environment : public MemoryRetainer {

Просмотреть файл

@ -1,48 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shelley Vohr <shelley.vohr@gmail.com>
Date: Thu, 23 Sep 2021 12:29:23 +0200
Subject: fix: crash creating private key with unsupported algorithm
This patch fixes an issue where some calls to crypto.createPrivateKey
made with algorithms unsupported by BoringSSL cause a crash when invoking
methods on their return values. This was happening because BoringSSL
shims some algorithms but doesn't implement them and so attempted to
created keys with them will fail (see https://source.chromium.org/chromium/chromium/src/+/main:third_party/boringssl/src/include/openssl/evp.h;l=835-837?q=ed448&ss=chromium)
Node.js returned false in initEdRaw (see: https://github.com/nodejs/node/blob/20cf47004e7801ede1588d2de8785c0100f6ab38/src/crypto/crypto_keys.cc#L1106)
but then did nothing with the return value, meaning that if no pkey was
created successfully that a key object was still returned but attempts
to use the data_ field would crash the process as data_ was never
assigned. This is fixed by checking the return value of initEdRaw at the
JavaScript level and throwing an error if the function returns false.
This patch will be upstreamed in some form.
diff --git a/lib/internal/crypto/keys.js b/lib/internal/crypto/keys.js
index ce053fbb4b800a67adcd5642a6ef09f8f2a21ce6..1b0e4b8791cf422bba331b242cd7df29b18c9da8 100644
--- a/lib/internal/crypto/keys.js
+++ b/lib/internal/crypto/keys.js
@@ -436,15 +436,19 @@ function getKeyObjectHandleFromJwk(key, ctx) {
const handle = new KeyObjectHandle();
if (isPublic) {
- handle.initEDRaw(
+ if (!handle.initEDRaw(
`NODE-${key.crv.toUpperCase()}`,
keyData,
- kKeyTypePublic);
+ kKeyTypePublic)) {
+ throw new Error('Failed to create key - unsupported algorithm');
+ }
} else {
- handle.initEDRaw(
+ if (!handle.initEDRaw(
`NODE-${key.crv.toUpperCase()}`,
keyData,
- kKeyTypePrivate);
+ kKeyTypePrivate)) {
+ throw new Error('Failed to create key - unsupported algorithm');
+ }
}
return handle;

Просмотреть файл

@ -17,10 +17,10 @@ Upstreams:
- https://github.com/nodejs/node/pull/39136
diff --git a/src/crypto/crypto_common.cc b/src/crypto/crypto_common.cc
index f4b7bd3ad8548a0b69943ddea669e6f1991b7a49..dc4f6737d7709fda9bb1350a0d3ed342d83b7044 100644
index cc03fddd464b09dd3647e3f5183dc3c49affc94f..9cbe78c05b1c86c0d4a4b8b1f8771862dd3002e5 100644
--- a/src/crypto/crypto_common.cc
+++ b/src/crypto/crypto_common.cc
@@ -242,7 +242,7 @@ const char* GetClientHelloALPN(const SSLPointer& ssl) {
@@ -244,7 +244,7 @@ const char* GetClientHelloALPN(const SSLPointer& ssl) {
const unsigned char* buf;
size_t len;
size_t rem;
@ -29,7 +29,7 @@ index f4b7bd3ad8548a0b69943ddea669e6f1991b7a49..dc4f6737d7709fda9bb1350a0d3ed342
if (!SSL_client_hello_get0_ext(
ssl.get(),
TLSEXT_TYPE_application_layer_protocol_negotiation,
@@ -255,13 +255,15 @@ const char* GetClientHelloALPN(const SSLPointer& ssl) {
@@ -257,13 +257,15 @@ const char* GetClientHelloALPN(const SSLPointer& ssl) {
len = (buf[0] << 8) | buf[1];
if (len + 2 != rem) return nullptr;
return reinterpret_cast<const char*>(buf + 3);
@ -46,7 +46,7 @@ index f4b7bd3ad8548a0b69943ddea669e6f1991b7a49..dc4f6737d7709fda9bb1350a0d3ed342
if (!SSL_client_hello_get0_ext(
ssl.get(),
TLSEXT_TYPE_server_name,
@@ -283,6 +285,8 @@ const char* GetClientHelloServerName(const SSLPointer& ssl) {
@@ -285,6 +287,8 @@ const char* GetClientHelloServerName(const SSLPointer& ssl) {
if (len + 2 > rem)
return nullptr;
return reinterpret_cast<const char*>(buf + 5);
@ -55,7 +55,7 @@ index f4b7bd3ad8548a0b69943ddea669e6f1991b7a49..dc4f6737d7709fda9bb1350a0d3ed342
}
const char* GetServerName(SSL* ssl) {
@@ -290,7 +294,10 @@ const char* GetServerName(SSL* ssl) {
@@ -292,7 +296,10 @@ const char* GetServerName(SSL* ssl) {
}
bool SetGroups(SecureContext* sc, const char* groups) {
@ -66,7 +66,7 @@ index f4b7bd3ad8548a0b69943ddea669e6f1991b7a49..dc4f6737d7709fda9bb1350a0d3ed342
}
const char* X509ErrorCode(long err) { // NOLINT(runtime/int)
@@ -757,13 +764,13 @@ MaybeLocal<Array> GetClientHelloCiphers(
@@ -771,13 +778,13 @@ MaybeLocal<Array> GetClientHelloCiphers(
Environment* env,
const SSLPointer& ssl) {
EscapableHandleScope scope(env->isolate());
@ -84,10 +84,10 @@ index f4b7bd3ad8548a0b69943ddea669e6f1991b7a49..dc4f6737d7709fda9bb1350a0d3ed342
Local<Object> obj = Object::New(env->isolate());
if (!Set(env->context(),
diff --git a/src/crypto/crypto_dh.cc b/src/crypto/crypto_dh.cc
index 1c48f98656fd211403354bb88331450e51ffb3e5..19029e058eb7ebbea283ad49be47c0c6246cf4e7 100644
index 86475e3b1b1e017c7b81a858354632accf9618de..02fa7d27cecea61b4321b551c2f6e1609f519c89 100644
--- a/src/crypto/crypto_dh.cc
+++ b/src/crypto/crypto_dh.cc
@@ -120,13 +120,11 @@ void DiffieHellman::MemoryInfo(MemoryTracker* tracker) const {
@@ -122,13 +122,11 @@ void DiffieHellman::MemoryInfo(MemoryTracker* tracker) const {
bool DiffieHellman::Init(const char* p, int p_len, int g) {
dh_.reset(DH_new());
if (p_len <= 0) {
@ -103,7 +103,7 @@ index 1c48f98656fd211403354bb88331450e51ffb3e5..19029e058eb7ebbea283ad49be47c0c6
return false;
}
BIGNUM* bn_p =
@@ -144,21 +142,18 @@ bool DiffieHellman::Init(const char* p, int p_len, int g) {
@@ -146,21 +144,18 @@ bool DiffieHellman::Init(const char* p, int p_len, int g) {
bool DiffieHellman::Init(const char* p, int p_len, const char* g, int g_len) {
dh_.reset(DH_new());
if (p_len <= 0) {
@ -128,7 +128,7 @@ index 1c48f98656fd211403354bb88331450e51ffb3e5..19029e058eb7ebbea283ad49be47c0c6
return false;
}
BIGNUM* bn_p =
@@ -478,16 +473,20 @@ EVPKeyCtxPointer DhKeyGenTraits::Setup(DhKeyPairGenConfig* params) {
@@ -480,16 +475,20 @@ EVPKeyCtxPointer DhKeyGenTraits::Setup(DhKeyPairGenConfig* params) {
if (!BN_set_word(bn_g.get(), params->params.generator) ||
!DH_set0_pqg(dh.get(), prime, nullptr, bn_g.get()))
return EVPKeyCtxPointer();
@ -150,7 +150,7 @@ index 1c48f98656fd211403354bb88331450e51ffb3e5..19029e058eb7ebbea283ad49be47c0c6
if (!param_ctx ||
EVP_PKEY_paramgen_init(param_ctx.get()) <= 0 ||
EVP_PKEY_CTX_set_dh_paramgen_prime_len(
@@ -499,8 +498,10 @@ EVPKeyCtxPointer DhKeyGenTraits::Setup(DhKeyPairGenConfig* params) {
@@ -501,8 +500,10 @@ EVPKeyCtxPointer DhKeyGenTraits::Setup(DhKeyPairGenConfig* params) {
EVP_PKEY_paramgen(param_ctx.get(), &raw_params) <= 0) {
return EVPKeyCtxPointer();
}

Просмотреть файл

@ -48,10 +48,10 @@ index 71a07a63a3636ab211746004ebab24a0058b08fc..e3ce67987ee3185a93750ebad72beab3
if (currentCounter === lastCounter)
return cachedCwd;
diff --git a/lib/internal/worker.js b/lib/internal/worker.js
index d59399bfefed10f85e0adac7ef9fefc0cb1ae67c..ad70afa311d0a0418d788920b42259f94c283006 100644
index 1d2cd8cefd2996c6a4f84ea08e6b4c53a22dc418..28b1a9a53b13036297a2ed3271c36cbe14c51a32 100644
--- a/lib/internal/worker.js
+++ b/lib/internal/worker.js
@@ -91,7 +91,8 @@ let cwdCounter;
@@ -90,7 +90,8 @@ let cwdCounter;
const environmentData = new SafeMap();

Просмотреть файл

@ -330,7 +330,7 @@ describe('node feature', () => {
expect(() => {
crypto.createPrivateKey({ key: ed448, format: 'jwk' });
}).to.throw(/Failed to create key - unsupported algorithm/);
}).to.throw(/Invalid JWK data/);
});
});