Skip to content

Commit 3bd39fb

Browse files
RafaelGSSaddaleax
authored andcommitted
src: ensure to close stream when destroying session
Co-Authored-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Michael Dawson <midawson@redhat.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> PR-URL: nodejs-private/node-private#561 Fixes: https://hackerone.com/reports/2319584 CVE-ID: CVE-2024-27983
1 parent 5f0f96b commit 3bd39fb

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/node_http2.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -605,6 +605,12 @@ Http2Session::Http2Session(Http2State* http2_state,
605605
Http2Session::~Http2Session() {
606606
CHECK(!is_in_scope());
607607
Debug(this, "freeing nghttp2 session");
608+
// Ensure that all `Http2Stream` instances and the memory they hold
609+
// on to are destroyed before the nghttp2 session is.
610+
for (const auto& [id, stream] : streams_) {
611+
stream->Detach();
612+
}
613+
streams_.clear();
608614
// Explicitly reset session_ so the subsequent
609615
// current_nghttp2_memory_ check passes.
610616
session_.reset();

0 commit comments

Comments
 (0)