Gabriel Schulhof
6edf88284b
n-api: finalize during second-pass callback
...
Calling into the engine from a weak callback is unsafe, however, the
engine offers a way to attach a second-pass weak callback which gets
called when it is safe to call into JavaScript. This moves the point
at which the N-API finalize callback gets called to this latter point.
Fixes: https://github.com/nodejs/node/issues/25927
PR-URL: https://github.com/nodejs/node/pull/25992
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com >
2019-02-11 15:53:14 -08:00
Anna Henningsen
5bc6e493c0
worker: set up child Isolate inside Worker thread
...
Refs: https://github.com/nodejs/node/issues/24016
PR-URL: https://github.com/nodejs/node/pull/26011
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2019-02-11 19:57:19 +01:00
Anna Henningsen
58ba8bfc46
worker: pre-allocate thread id
...
Allocate a thread id before actually creating the Environment instance.
PR-URL: https://github.com/nodejs/node/pull/26011
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2019-02-11 19:57:14 +01:00
gengjiawen
e11388b245
src: remove unused method in class Http2Stream
...
PR-URL: https://github.com/nodejs/node/pull/25979
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
2019-02-11 09:00:39 +01:00
Matteo Collina
9af04ad684
http2: improve compat performance
...
This bunch of commits help me improve the performance of a http2
server by 8-10%. The benchmarks reports several 1-2% improvements in
various areas.
PR-URL: https://github.com/nodejs/node/pull/25567
Reviewed-By: Benedikt Meurer <benedikt.meurer@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-02-11 08:50:07 +01:00
gengjiawen
851cebbff6
src: remove redundant cast in node_file.cc
...
PR-URL: https://github.com/nodejs/node/pull/25977
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2019-02-11 07:20:16 +01:00
gengjiawen
2e405e576b
src: remove unused class in node_errors.h
...
PR-URL: https://github.com/nodejs/node/pull/25980
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
2019-02-11 05:39:26 +01:00
gengjiawen
ba4df925eb
src: remove redundant void
...
PR-URL: https://github.com/nodejs/node/pull/26003
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2019-02-10 14:20:31 +01:00
gengjiawen
ea2350bb00
src: fix return type in Hash
...
PR-URL: https://github.com/nodejs/node/pull/25936
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-02-09 17:19:17 +01:00
gengjiawen
2fa6376ec9
src: refactor macro to std::min in node_buffer.cc
...
PR-URL: https://github.com/nodejs/node/pull/25919
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com >
2019-02-09 17:16:22 +01:00
gengjiawen
c2d374fccc
src: remove unused method in env.h
...
Signed-off-by: gengjiawen <technicalcute@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/25934
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2019-02-09 15:16:05 +01:00
Anna Henningsen
8b79c15b6f
src: pass along errors from StreamBase req obj creations
...
PR-URL: https://github.com/nodejs/node/pull/25822
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
2019-02-08 21:03:56 +01:00
Anna Henningsen
63d398c9bb
src: pass along errors from fs object creations
...
PR-URL: https://github.com/nodejs/node/pull/25822
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
2019-02-08 21:03:55 +01:00
Anna Henningsen
730a27df40
src: pass along errors from http2 object creation
...
PR-URL: https://github.com/nodejs/node/pull/25822
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
2019-02-08 21:03:54 +01:00
Anna Henningsen
03908d270d
src: pass along errors from tls object creation
...
PR-URL: https://github.com/nodejs/node/pull/25822
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
2019-02-08 21:03:53 +01:00
James M Snell
bcdd228f90
perf_hooks: implement histogram based api
...
Add a sampling-based event loop delay monitor.
```js
const { monitorEventLoopDelay } = require('perf_hooks');
const h = monitorEventLoopDelay();
h.enable();
h.disable();
console.log(h.percentiles);
console.log(h.min);
console.log(h.max);
console.log(h.mean);
console.log(h.stddev);
console.log(h.percentile(50));
```
PR-URL: https://github.com/nodejs/node/pull/25378
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com >
Reviewed-By: Richard Lau <riclau@uk.ibm.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2019-02-08 09:20:18 -08:00
cjihrig
679c23f2ae
report: use uv_getnameinfo() for socket endpoints
...
PR-URL: https://github.com/nodejs/node/pull/25962
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Richard Lau <riclau@uk.ibm.com >
2019-02-08 11:32:08 -05:00
cjihrig
39171d755d
report: widen scope of #ifndef
...
This commit moves a #ifndef _WIN32 to contain the entire if
statement that inspects file descriptors. Prior to this commit,
the #ifndef was inside the if, making it essentially dead code
on Windows.
PR-URL: https://github.com/nodejs/node/pull/25960
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Richard Lau <riclau@uk.ibm.com >
2019-02-08 09:11:15 -05:00
cjihrig
4b4d46539d
report: remove unnecessary case block scopes
...
PR-URL: https://github.com/nodejs/node/pull/25960
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Richard Lau <riclau@uk.ibm.com >
2019-02-08 09:11:10 -05:00
cjihrig
e49040bd11
report: remove empty string stream insertion
...
PR-URL: https://github.com/nodejs/node/pull/25960
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Richard Lau <riclau@uk.ibm.com >
2019-02-08 09:10:35 -05:00
Gireesh Punathil
c70e853723
src: nullcheck on trace controller
...
Insert a NULLCHECK prior to return. Ideally we do this in the caller,
but the TraceController object is somewhat special as:
1. It is accessed by most threads
2. It's life cycle is managed by Agent::Agent
3. It's getter is invoked through Base Methods (upstream)
Refs: https://github.com/nodejs/node/issues/25814
PR-URL: https://github.com/nodejs/node/pull/25943
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Masashi Hirano <shisama07@gmail.com >
Reviewed-By: Richard Lau <riclau@uk.ibm.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2019-02-08 14:57:42 +01:00
Tom Gallacher
f265225c19
src: allow --perf-prof-unwinding-info in NODE_OPTIONS
...
PR-URL: https://github.com/nodejs/node/pull/25565
Reviewed-By: Sam Roberts <vieuxtech@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-02-08 14:43:18 +01:00
Tom Gallacher
f5b9a782a9
src: allow --perf-basic-prof-only-functions in NODE_OPTIONS
...
PR-URL: https://github.com/nodejs/node/pull/25565
Reviewed-By: Sam Roberts <vieuxtech@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-02-08 14:43:16 +01:00
Gireesh Punathil
7182aca108
src: make watchdog async callback a lambda
...
`Watchdog::Async` features only once for the
async callback, so make it a lambda.
PR-URL: https://github.com/nodejs/node/pull/25945
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2019-02-08 13:01:25 +05:30
gengjiawen
3a02d39df9
src: make deleted function public in agent.h
...
Signed-off-by: gengjiawen <technicalcute@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/25909
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com >
2019-02-08 07:22:24 +01:00
Joyee Cheung
b44131ab92
lib: use internal/options to query --abort-on-uncaught-exception
...
Instead of using
`internalBinding('config').shouldAbortOnUncaughtException`.
Also removes that property from the binding.
PR-URL: https://github.com/nodejs/node/pull/25862
Reviewed-By: Richard Lau <riclau@uk.ibm.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2019-02-08 08:09:56 +08:00
gengjiawen
4e07d210e1
src: use bool instead of integer literal in connection_wrap.cc
...
Signed-off-by: gengjiawen <technicalcute@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/25923
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Richard Lau <riclau@uk.ibm.com >
2019-02-07 08:14:47 +01:00
gengjiawen
abba1020f4
src: refactor to nullptr in cpp code
...
Signed-off-by: gengjiawen <technicalcute@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/25888
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Refael Ackermann <refack@gmail.com >
2019-02-07 07:39:42 +01:00
gengjiawen
0e54a0a213
src: clean unused code in agent.h
...
Signed-off-by: gengjiawen <technicalcute@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/25914
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-02-07 07:30:26 +01:00
ZYSzys
93e0c6ae89
src: use NULL check macros to check nullptr
...
PR-URL: https://github.com/nodejs/node/pull/25916
Refs: https://github.com/nodejs/node/pull/20914
Reviewed-By: Masashi Hirano <shisama07@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Richard Lau <riclau@uk.ibm.com >
2019-02-07 07:22:38 +01:00
Daniel Bevenius
d310d8df62
src: fix compiler warnings in node_buffer.cc
...
Currently the following compiler warnings are generated on Linux:
../src/node_buffer.cc:
In function 'void node::Buffer::{anonymous}::StringSlice(
const v8::FunctionCallbackInfo<v8::Value>&)
[with node::encoding encoding = (node::encoding)1]':
../src/node_buffer.cc:54:20: warning:
'start' may be used uninitialized in this function
[-Wmaybe-uninitialized]
if (end < start) end = start;
^~~
../src/node_buffer.cc:50:10: note: 'start' was declared here
size_t start;
^~~~~
This commit initializes start and end to zero to avoid these warnings.
PR-URL: https://github.com/nodejs/node/pull/25665
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com >
Reviewed-By: Richard Lau <riclau@uk.ibm.com >
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-02-07 05:33:11 +01:00
Joyee Cheung
475c43c1b0
perf_hooks: only enable GC tracking when it's requested
...
Previously a GC prologue callback and a GC epilogue callback
are always unconditionally enabled during bootstrap when
the `performance` binding is loaded, even when the user does
not use the performance timeline API to enable GC tracking.
This patch makes the callback addition conditional and only
enables them when the user explicitly requests
`observer.observe(['gc'])` to avoid the overhead.
PR-URL: https://github.com/nodejs/node/pull/25853
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-02-06 20:02:59 +01:00
Anna Henningsen
91adbe14b4
report: include information about event loop itself
...
PR-URL: https://github.com/nodejs/node/pull/25906
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Richard Lau <riclau@uk.ibm.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-02-06 15:36:24 +01:00
gengjiawen
686043e76e
src: remove redundant method in node_worker.h
...
Signed-off-by: gengjiawen <technicalcute@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/25849
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-02-06 05:55:43 +01:00
gengjiawen
0de44436a9
src: delete unreachable code in node_perf.h
...
Signed-off-by: gengjiawen <technicalcute@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/25850
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-02-06 05:49:27 +01:00
Joyee Cheung
eb68619f95
src: move process.reallyExit impl into node_process_methods.cc
...
Because the part that is shared by `process.reallyExit` and the
Node.js teardown is `WaitForInspectorDisconnect()`, move that
into node_internals.h instead, and move the C++ binding code
into `node_process_methods.cc` since that's the only place
it's needed.
PR-URL: https://github.com/nodejs/node/pull/25860
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Minwoo Jung <minwoo@nodesource.com >
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com >
2019-02-06 05:36:35 +01:00
gengjiawen
d3ea63921f
src: fix data type in node_crypto.cc
...
Signed-off-by: gengjiawen <technicalcute@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/25889
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-02-06 05:26:50 +01:00
Sam Roberts
62b4796e36
tls: in-line comments and other cleanups
...
PR-URL: https://github.com/nodejs/node/pull/25861
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2019-02-05 15:17:53 -08:00
Sam Roberts
cccc33b0b4
src: const_cast is necessary for 1.1.1, not 0.9.7
...
The const_cast used to be necessary for SSL_get_app_data() in OpenSSL
0.9.7, but node doesn't compile against OpenSSL versions that old.
However, now it's needed for the recently introduced
SSL_renegotiate_pending(), which is not const-correct as of 1.1.1a.
PR-URL: https://github.com/nodejs/node/pull/25861
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2019-02-05 15:16:58 -08:00
Sam Roberts
80f92cf9af
src: refactor SSLError case statement
...
- Don't use both break and return simultaneously.
- Use case:/UNREACHABLE() to enforce that all cases are handled, instead
of CHECK().
PR-URL: https://github.com/nodejs/node/pull/25861
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2019-02-05 15:16:45 -08:00
Sam Roberts
24ea4a3452
src: organize TLSWrap declarations by parent
...
Make it clear which of the multiple interfaces a TLSWrap method is
implementing by grouping and commenting the related methods.
PR-URL: https://github.com/nodejs/node/pull/25861
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2019-02-05 15:16:34 -08:00
Sam Roberts
73b204cd2b
src: remove unused TLWrap::EnableTrace()
...
Declaration is unused, it was added by mistake in 46c5c3388d .
PR-URL: https://github.com/nodejs/node/pull/25861
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2019-02-05 15:16:28 -08:00
Anna Henningsen
b1cc1af2bd
worker: add mutex lock to MessagePort ctor
...
Automated tooling for race condition detection reports this as a
possible problem. It’s unlikely that something bad would happen
here (beyond maybe calling `TriggerAsync()` twice), but adding this
should be okay.
PR-URL: https://github.com/nodejs/node/pull/25911
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Minwoo Jung <minwoo@nodesource.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-02-05 22:27:53 +01:00
Anna Henningsen
39eca841c3
src: split ownsProcessState off isMainThread
...
Embedders may want to control whether a Node.js instance
controls the current process, similar to what we currently
have with `Worker`s.
Previously, the `isMainThread` flag had a bit of a double usage,
both for indicating whether we are (not) running a Worker and
whether we can modify per-process state.
PR-URL: https://github.com/nodejs/node/pull/25881
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-02-05 21:55:54 +01:00
Anna Henningsen
46d9573c68
src: add PrintLibuvHandleInformation debug helper
...
This function is not only helpful for debugging crashes,
but can also be used as an ad-hoc debugging statement.
PR-URL: https://github.com/nodejs/node/pull/25905
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-02-05 21:53:18 +01:00
cjihrig
2ed556c11f
report: print libuv handle addresses as hex
...
PR-URL: https://github.com/nodejs/node/pull/25910
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Richard Lau <riclau@uk.ibm.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-02-05 12:09:45 -05:00
Anna Henningsen
63ab54248b
worker,etw: only enable ETW on the main thread
...
The Windows ETW code is not written to be compatible with multi
threading, and in particular it relies on global state like a
single static `uv_async_t`. Adding that to multiple threads
would corrupt the corresponding loops' handle queues.
This addresses the flakiness of at least
`test-worker-exit-code` and very likely other flaky tests that
relate to Worker threads on Windows as well.
Fixes: https://github.com/nodejs/node/issues/25847
Fixes: https://github.com/nodejs/node/issues/25702
Fixes: https://github.com/nodejs/node/issues/24005
Fixes: https://github.com/nodejs/node/issues/23873
PR-URL: https://github.com/nodejs/node/pull/25907
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Richard Lau <riclau@uk.ibm.com >
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-02-05 18:05:20 +01:00
cjihrig
9bbe29dcce
report: use libuv calls for OS and machine info
...
PR-URL: https://github.com/nodejs/node/pull/25900
Fixes: https://github.com/nodejs/node/issues/25843
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Richard Lau <riclau@uk.ibm.com >
2019-02-05 08:56:16 -05:00
David Benjamin
50f9062396
crypto: don't crash X509ToObject on error
...
Use MaybeLocal::ToLocal and don't crash X509ToObject on error.
PR-URL: https://github.com/nodejs/node/pull/25717
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2019-02-05 07:28:09 +01:00
David Benjamin
ebda39a2a9
crypto: fix malloc mixing in X509ToObject
...
EC_KEY_key2buf returns an OPENSSL_malloc'd pointer so it shouldn't be
passed into Buffer::New, which expect a libc malloc'd pointer. Instead,
factor out the ECDH::GetPublicKey code which uses EC_POINT_point2oct.
This preserves the existing behavior where encoding failures are
silently ignored, but it is probably safe to CHECK fail them instead.
PR-URL: https://github.com/nodejs/node/pull/25717
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2019-02-05 07:17:37 +01:00