diff options
author | Anna Henningsen <anna@addaleax.net> | 2018-12-16 16:34:37 +0300 |
---|---|---|
committer | Beth Griggs <Bethany.Griggs@uk.ibm.com> | 2019-07-16 19:38:00 +0300 |
commit | 14090b59fcafbb11c6df84b9aaee7a77cf6f0500 (patch) | |
tree | e536c0b0a7e604c8c4fc5f76344d1ad7d08c2d34 /src | |
parent | 0dee60740917cc9034497a60c6d7227cb2ec9682 (diff) |
worker: fix nullptr deref after MessagePort deser failure
This would previously always have crashed when deserializing
a `MessagePort` fails, because there was always at least one
`nullptr` entry in the vector.
PR-URL: https://github.com/nodejs/node/pull/25076
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/node_messaging.cc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/node_messaging.cc b/src/node_messaging.cc index c9b5e324479..ae60187b6f3 100644 --- a/src/node_messaging.cc +++ b/src/node_messaging.cc @@ -90,7 +90,8 @@ MaybeLocal<Value> Message::Deserialize(Environment* env, if (ports[i] == nullptr) { for (MessagePort* port : ports) { // This will eventually release the MessagePort object itself. - port->Close(); + if (port != nullptr) + port->Close(); } return MaybeLocal<Value>(); } |