Header table size UINT32_MAX must be accepted
This commit is contained in:
parent
ebf27e6523
commit
8c701bb139
|
@ -784,9 +784,6 @@ int nghttp2_iv_check(const nghttp2_settings_entry *iv, size_t niv) {
|
||||||
for (i = 0; i < niv; ++i) {
|
for (i = 0; i < niv; ++i) {
|
||||||
switch (iv[i].settings_id) {
|
switch (iv[i].settings_id) {
|
||||||
case NGHTTP2_SETTINGS_HEADER_TABLE_SIZE:
|
case NGHTTP2_SETTINGS_HEADER_TABLE_SIZE:
|
||||||
if (iv[i].value > NGHTTP2_MAX_HEADER_TABLE_SIZE) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS:
|
case NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS:
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -65,9 +65,6 @@
|
||||||
/* The number of bytes for each SETTINGS entry */
|
/* The number of bytes for each SETTINGS entry */
|
||||||
#define NGHTTP2_FRAME_SETTINGS_ENTRY_LENGTH 6
|
#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 */
|
/* Length of priority related fields in HEADERS/PRIORITY frames */
|
||||||
#define NGHTTP2_PRIORITY_SPECLEN 5
|
#define NGHTTP2_PRIORITY_SPECLEN 5
|
||||||
|
|
||||||
|
|
|
@ -4027,12 +4027,6 @@ int nghttp2_session_on_settings_received(nghttp2_session *session,
|
||||||
switch (entry->settings_id) {
|
switch (entry->settings_id) {
|
||||||
case NGHTTP2_SETTINGS_HEADER_TABLE_SIZE:
|
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,
|
rv = nghttp2_hd_deflate_change_table_size(&session->hd_deflater,
|
||||||
entry->value);
|
entry->value);
|
||||||
if (rv != 0) {
|
if (rv != 0) {
|
||||||
|
|
|
@ -537,10 +537,11 @@ void test_nghttp2_iv_check(void) {
|
||||||
iv[1].value = 0;
|
iv[1].value = 0;
|
||||||
CU_ASSERT(nghttp2_iv_check(iv, 2));
|
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].settings_id = NGHTTP2_SETTINGS_HEADER_TABLE_SIZE;
|
||||||
iv[1].value = UINT32_MAX;
|
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 */
|
/* Too small SETTINGS_MAX_FRAME_SIZE */
|
||||||
iv[0].settings_id = NGHTTP2_SETTINGS_MAX_FRAME_SIZE;
|
iv[0].settings_id = NGHTTP2_SETTINGS_MAX_FRAME_SIZE;
|
||||||
|
|
Loading…
Reference in New Issue