@@ -284,15 +284,15 @@ rcv_rst_stream_frame(Http2ClientSession &cs, Http2ConnectionState &cstate, const
284284 DebugSsn (&cs, " http2_cs" , " [%" PRId64 " ] Received RST_STREAM frame." , cs.connection_id ());
285285
286286 Http2Stream *stream = cstate.find_stream (frame.header ().streamid );
287- if (stream == NULL ) {
287+ if (frame. header (). streamid == 0 ) {
288288 return HTTP2_ERROR_PROTOCOL_ERROR;
289289 }
290290
291291 if (frame.header ().length != HTTP2_RST_STREAM_LEN) {
292292 return HTTP2_ERROR_FRAME_SIZE_ERROR;
293293 }
294294
295- if (!stream->change_state (frame.header ().type , frame.header ().flags )) {
295+ if (stream != NULL && !stream->change_state (frame.header ().type , frame.header ().flags )) {
296296 // If a RST_STREAM frame identifying an idle stream is received, the
297297 // recipient MUST treat this as a connection error of type PROTOCOL_ERROR.
298298 return HTTP2_ERROR_PROTOCOL_ERROR;
@@ -304,9 +304,11 @@ rcv_rst_stream_frame(Http2ClientSession &cs, Http2ConnectionState &cstate, const
304304 return HTTP2_ERROR_PROTOCOL_ERROR;
305305 }
306306
307- DebugSsn (&cs, " http2_cs" , " [%" PRId64 " ] RST_STREAM: Stream ID: %u, Error Code: %u)" , cs.connection_id (), stream->get_id (),
308- rst_stream.error_code );
309- cstate.delete_stream (stream);
307+ if (stream != NULL ) {
308+ DebugSsn (&cs, " http2_cs" , " [%" PRId64 " ] RST_STREAM: Stream ID: %u, Error Code: %u)" , cs.connection_id (), stream->get_id (),
309+ rst_stream.error_code );
310+ cstate.delete_stream (stream);
311+ }
310312
311313 return HTTP2_ERROR_NO_ERROR;
312314}
0 commit comments