Skip to content

Commit 0fb816d

Browse files
RafaelGSSaddaleax
andcommittedApr 2, 2024
src: ensure to close stream when destroying session
Co-Authored-By: Anna Henningsen <anna@addaleax.net> PR-URL: nodejs-private/node-private#561 Fixes: https://hackerone.com/reports/2319584 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> CVE-ID: CVE-2024-27983
1 parent 8c8961d commit 0fb816d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed
 

‎src/node_http2.cc

+6
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,12 @@ Http2Session::Http2Session(Http2State* http2_state,
528528
Http2Session::~Http2Session() {
529529
CHECK(!is_in_scope());
530530
Debug(this, "freeing nghttp2 session");
531+
// Ensure that all `Http2Stream` instances and the memory they hold
532+
// on to are destroyed before the nghttp2 session is.
533+
for (const auto& [id, stream] : streams_) {
534+
stream->Detach();
535+
}
536+
streams_.clear();
531537
// Explicitly reset session_ so the subsequent
532538
// current_nghttp2_memory_ check passes.
533539
session_.reset();

0 commit comments

Comments
 (0)
Please sign in to comment.