Use NGHTTP2_PROTOCOL_ERROR for WINDOW_UPDATE with increments == 0

This commit is contained in:
Tatsuhiro Tsujikawa 2014-12-10 01:02:30 +09:00
parent dce20c3e6a
commit f705b2aec4
1 changed files with 13 additions and 6 deletions

View File

@ -3951,8 +3951,12 @@ static int
session_on_connection_window_update_received(nghttp2_session *session,
nghttp2_frame *frame) {
/* Handle connection-level flow control */
if (frame->window_update.window_size_increment == 0 ||
NGHTTP2_MAX_WINDOW_SIZE - frame->window_update.window_size_increment <
if (frame->window_update.window_size_increment == 0) {
return session_handle_invalid_connection(session, frame,
NGHTTP2_PROTOCOL_ERROR, NULL);
}
if (NGHTTP2_MAX_WINDOW_SIZE - frame->window_update.window_size_increment <
session->remote_window_size) {
return session_handle_invalid_connection(session, frame,
NGHTTP2_FLOW_CONTROL_ERROR, NULL);
@ -3980,8 +3984,11 @@ static int session_on_stream_window_update_received(nghttp2_session *session,
session, frame, NGHTTP2_PROTOCOL_ERROR,
"WINDOW_UPADATE to reserved stream");
}
if (frame->window_update.window_size_increment == 0 ||
NGHTTP2_MAX_WINDOW_SIZE - frame->window_update.window_size_increment <
if (frame->window_update.window_size_increment == 0) {
return session_handle_invalid_stream(session, frame,
NGHTTP2_PROTOCOL_ERROR);
}
if (NGHTTP2_MAX_WINDOW_SIZE - frame->window_update.window_size_increment <
stream->remote_window_size) {
return session_handle_invalid_stream(session, frame,
NGHTTP2_FLOW_CONTROL_ERROR);