Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/NodeBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,17 @@ class NodeJsBuilder {
join(this.patchDir, 'push_registers_asm.cc.patch'));
}

async patchBugs() {
await patchFile(
this.nodePath('src', 'crypto', 'crypto_tls.cc'),
join(this.patchDir, 'crypto_tls.cc.patch')
);
}

async applyPatches() {
await this.patchThirdPartyMain();
await this.patchNodeCompileIssues();
await this.patchNodeCompileIssues();
await this.patchBugs();
}

printDiskUsage() {
Expand Down
23 changes: 23 additions & 0 deletions src/patch/18.15.0/crypto_tls.cc.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
diff --git a/src/crypto/crypto_tls.cc b/src/crypto/crypto_tls.cc
index 3656f3e206..eed252fc9a 100644
--- a/src/crypto/crypto_tls.cc
+++ b/src/crypto/crypto_tls.cc
@@ -225,7 +225,7 @@ int SelectALPNCallback(
const unsigned char* in,
unsigned int inlen,
void* arg) {
- TLSWrap* w = static_cast<TLSWrap*>(arg);
+ TLSWrap* w = static_cast<TLSWrap*>(SSL_get_app_data(s));
const std::vector<unsigned char>& alpn_protos = w->alpn_protos_;

if (alpn_protos.empty()) return SSL_TLSEXT_ERR_NOACK;
@@ -1520,7 +1520,8 @@ void TLSWrap::SetALPNProtocols(const FunctionCallbackInfo<Value>& args) {
} else {
w->alpn_protos_ = std::vector<unsigned char>(
protos.data(), protos.data() + protos.length());
- SSL_CTX_set_alpn_select_cb(SSL_get_SSL_CTX(ssl), SelectALPNCallback, w);
+ SSL_CTX* ssl_ctx = SSL_get_SSL_CTX(ssl);
+ SSL_CTX_set_alpn_select_cb(ssl_ctx, SelectALPNCallback, nullptr);
}
}