From 8c701bb139c43a9eb450a2d659294462a41f1b53 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Thu, 30 Jul 2015 21:19:25 +0900 Subject: [PATCH] Header table size UINT32_MAX must be accepted --- lib/nghttp2_frame.c | 3 --- lib/nghttp2_frame.h | 3 --- lib/nghttp2_session.c | 6 ------ tests/nghttp2_frame_test.c | 5 +++-- 4 files changed, 3 insertions(+), 14 deletions(-) diff --git a/lib/nghttp2_frame.c b/lib/nghttp2_frame.c index 07f93a1f..44e3807d 100644 --- a/lib/nghttp2_frame.c +++ b/lib/nghttp2_frame.c @@ -784,9 +784,6 @@ int nghttp2_iv_check(const nghttp2_settings_entry *iv, size_t niv) { for (i = 0; i < niv; ++i) { switch (iv[i].settings_id) { case NGHTTP2_SETTINGS_HEADER_TABLE_SIZE: - if (iv[i].value > NGHTTP2_MAX_HEADER_TABLE_SIZE) { - return 0; - } break; case NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS: break; diff --git a/lib/nghttp2_frame.h b/lib/nghttp2_frame.h index 7fc336c1..8a420c56 100644 --- a/lib/nghttp2_frame.h +++ b/lib/nghttp2_frame.h @@ -65,9 +65,6 @@ /* The number of bytes for each SETTINGS entry */ #define NGHTTP2_FRAME_SETTINGS_ENTRY_LENGTH 6 -/* The maximum header table size in SETTINGS_HEADER_TABLE_SIZE */ -#define NGHTTP2_MAX_HEADER_TABLE_SIZE ((1u << 31) - 1) - /* Length of priority related fields in HEADERS/PRIORITY frames */ #define NGHTTP2_PRIORITY_SPECLEN 5 diff --git a/lib/nghttp2_session.c b/lib/nghttp2_session.c index d9a74264..f99dfb7c 100644 --- a/lib/nghttp2_session.c +++ b/lib/nghttp2_session.c @@ -4027,12 +4027,6 @@ int nghttp2_session_on_settings_received(nghttp2_session *session, switch (entry->settings_id) { case NGHTTP2_SETTINGS_HEADER_TABLE_SIZE: - if (entry->value > NGHTTP2_MAX_HEADER_TABLE_SIZE) { - return session_handle_invalid_connection( - session, frame, NGHTTP2_ERR_HEADER_COMP, - "SETTINGS: too large SETTINGS_HEADER_TABLE_SIZE"); - } - rv = nghttp2_hd_deflate_change_table_size(&session->hd_deflater, entry->value); if (rv != 0) { diff --git a/tests/nghttp2_frame_test.c b/tests/nghttp2_frame_test.c index 0e0d1bee..2ed1cdea 100644 --- a/tests/nghttp2_frame_test.c +++ b/tests/nghttp2_frame_test.c @@ -537,10 +537,11 @@ void test_nghttp2_iv_check(void) { iv[1].value = 0; CU_ASSERT(nghttp2_iv_check(iv, 2)); - /* Too large SETTINGS_HEADER_TABLE_SIZE */ + /* Full size SETTINGS_HEADER_TABLE_SIZE (UINT32_MAX) must be + accepted */ iv[1].settings_id = NGHTTP2_SETTINGS_HEADER_TABLE_SIZE; iv[1].value = UINT32_MAX; - CU_ASSERT(!nghttp2_iv_check(iv, 2)); + CU_ASSERT(nghttp2_iv_check(iv, 2)); /* Too small SETTINGS_MAX_FRAME_SIZE */ iv[0].settings_id = NGHTTP2_SETTINGS_MAX_FRAME_SIZE;