nghttpx: Fix possible crash in rare case

This commit is contained in:
Tatsuhiro Tsujikawa 2016-03-15 00:46:15 +09:00
parent dd2bdf3e31
commit ab734f09b6
2 changed files with 10 additions and 0 deletions

View File

@ -1728,6 +1728,11 @@ int Http2Upstream::on_downstream_reset(bool no_retry) {
for (auto downstream = downstream_queue_.get_downstreams(); downstream;
downstream = downstream->dlnext) {
if (downstream->get_dispatch_state() != Downstream::DISPATCH_ACTIVE) {
// This is error condition when we failed push_request_headers()
// in initiate_downstream(). Otherwise, we have
// Downstream::DISPATCH_ACTIVE state, or we did not set
// DownstreamConnection.
downstream->pop_downstream_connection();
continue;
}

View File

@ -1224,6 +1224,11 @@ int SpdyUpstream::on_downstream_reset(bool no_retry) {
for (auto downstream = downstream_queue_.get_downstreams(); downstream;
downstream = downstream->dlnext) {
if (downstream->get_dispatch_state() != Downstream::DISPATCH_ACTIVE) {
// This is error condition when we failed push_request_headers()
// in initiate_downstream(). Otherwise, we have
// Downstream::DISPATCH_ACTIVE state, or we did not set
// DownstreamConnection.
downstream->pop_downstream_connection();
continue;
}