diff --git a/lib/quicly.c b/lib/quicly.c index 920d04b8..f0fbd26b 100644 --- a/lib/quicly.c +++ b/lib/quicly.c @@ -1868,11 +1868,16 @@ int quicly_encode_transport_parameter_list(ptls_buffer_t *buf, const quicly_tran { int ret; -#define PUSH_TP(buf, id, block) \ +#define PUSH_TP_NO_GREASE_CHECK(buf, id, block) \ do { \ ptls_buffer_push_quicint((buf), (id)); \ ptls_buffer_push_block((buf), -1, block); \ } while (0) +#define PUSH_TP(buf, id, block) \ + do { \ + PTLS_BUILD_ASSERT(((uint64_t)id + 31 - 27) % 31 != 0); \ + PUSH_TP_NO_GREASE_CHECK(buf, id, block); \ + } while (0) PUSH_TP(buf, QUICLY_TRANSPORT_PARAMETER_ID_MAX_UDP_PAYLOAD_SIZE, { ptls_buffer_push_quicint(buf, params->max_udp_payload_size); }); @@ -1927,7 +1932,7 @@ int quicly_encode_transport_parameter_list(ptls_buffer_t *buf, const quicly_tran { ptls_buffer_push_quicint(buf, params->max_datagram_frame_size); }); /* if requested, add a greasing TP of 1 MTU size so that CH spans across multiple packets */ if (expand_by != 0) { - PUSH_TP(buf, 31 * 100 + 27, { + PUSH_TP_NO_GREASE_CHECK(buf, 31 * 100 + 27, { if ((ret = ptls_buffer_reserve(buf, expand_by)) != 0) goto Exit; memset(buf->base + buf->off, 0, expand_by);