diff --git a/src/node_http2.cc b/src/node_http2.cc index b13632aa32d149..234504256b99bb 100644 --- a/src/node_http2.cc +++ b/src/node_http2.cc @@ -933,7 +933,12 @@ inline int Http2Session::OnHeaderCallback(nghttp2_session* handle, Http2Session* session = static_cast(user_data); int32_t id = GetFrameID(frame); Http2Stream* stream = session->FindStream(id); - CHECK_NE(stream, nullptr); + // If stream is null at this point, either something odd has happened + // or the stream was closed locally while header processing was occurring. + // either way, do not proceed and close the stream. + if (stream == nullptr) + return NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE; + // If the stream has already been destroyed, ignore. if (stream->IsDestroyed()) return 0;