@@ -815,6 +815,34 @@ static int test_hpack_dynamic_table_with_empty_header(struct aws_allocator *allo
815815 return AWS_OP_SUCCESS ;
816816}
817817
818+ AWS_TEST_CASE (hpack_dynamic_table_growth_corner_case , test_hpack_dynamic_table_growth_corner_case )
819+ static int test_hpack_dynamic_table_growth_corner_case (struct aws_allocator * allocator , void * ctx ) {
820+ (void )ctx ;
821+
822+ aws_http_library_init (allocator );
823+ struct aws_hpack_context context ;
824+ aws_hpack_context_init (& context , allocator , AWS_LS_HTTP_GENERAL , NULL );
825+
826+ DEFINE_STATIC_HEADER (h1 , "herp" , "derp" );
827+ DEFINE_STATIC_HEADER (h2 , "fizz" , "buzz" );
828+
829+ const size_t h1_size = aws_hpack_get_header_size (& h1 );
830+ const size_t h2_size = aws_hpack_get_header_size (& h2 );
831+
832+ ASSERT_SUCCESS (aws_hpack_insert_header (& context , & h1 ));
833+ ASSERT_UINT_EQUALS (1 , aws_hpack_get_dynamic_table_num_elements (& context ));
834+
835+ ASSERT_SUCCESS (aws_hpack_resize_dynamic_table (& context , h1_size + h2_size + 1 ));
836+ ASSERT_UINT_EQUALS (1 , aws_hpack_get_dynamic_table_num_elements (& context ));
837+
838+ ASSERT_SUCCESS (aws_hpack_insert_header (& context , & h2 ));
839+ ASSERT_UINT_EQUALS (2 , aws_hpack_get_dynamic_table_num_elements (& context ));
840+
841+ aws_hpack_context_clean_up (& context );
842+ aws_http_library_clean_up ();
843+ return AWS_OP_SUCCESS ;
844+ }
845+
818846AWS_TEST_CASE (hpack_dynamic_table_size_update_from_setting , test_hpack_dynamic_table_size_update_from_setting )
819847static int test_hpack_dynamic_table_size_update_from_setting (struct aws_allocator * allocator , void * ctx ) {
820848 (void )ctx ;
0 commit comments