Skip to content

Commit

Permalink
quic: fix PATH_CHALLENGE parser
Browse files Browse the repository at this point in the history
  • Loading branch information
riptl committed Nov 18, 2024
1 parent 1c1d27b commit aca5c23
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/waltz/quic/templ/fd_quic_frames_templ.h
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ FD_TEMPL_DEF_STRUCT_END(retire_conn_id_frame)

FD_TEMPL_DEF_STRUCT_BEGIN(path_challenge_frame)
FD_TEMPL_MBR_FRAME_TYPE( type, 0x1a,0x1a )
FD_TEMPL_MBR_ELEM_VARINT( data, ulong )
FD_TEMPL_MBR_ELEM_FIXED( data, ulong, 8 )
FD_TEMPL_DEF_STRUCT_END(path_challenge_frame)


Expand All @@ -307,7 +307,7 @@ FD_TEMPL_DEF_STRUCT_END(path_challenge_frame)

FD_TEMPL_DEF_STRUCT_BEGIN(path_response_frame)
FD_TEMPL_MBR_FRAME_TYPE( type, 0x1b,0x1b )
FD_TEMPL_MBR_ELEM_VARINT( data, ulong )
FD_TEMPL_MBR_ELEM_FIXED( data, ulong, 8 )
FD_TEMPL_DEF_STRUCT_END(path_response_frame)


Expand Down
21 changes: 21 additions & 0 deletions src/waltz/quic/tests/test_quic_conformance.c
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,26 @@ test_quic_server_alpn_fail( fd_quic_sandbox_t * sandbox,

}

static __attribute__((noinline)) void
test_quic_parse_path_challenge( void ) {
fd_quic_path_challenge_frame_t path_challenge[1];
fd_quic_path_response_frame_t path_response[1];

do {
uchar data[10] = {0x1a};
FD_TEST( fd_quic_decode_path_challenge_frame( path_challenge, data, 1UL )==FD_QUIC_PARSE_FAIL );
FD_TEST( fd_quic_decode_path_challenge_frame( path_challenge, data, 8UL )==FD_QUIC_PARSE_FAIL );
FD_TEST( fd_quic_decode_path_challenge_frame( path_challenge, data, 9UL )==9UL );
FD_TEST( fd_quic_decode_path_challenge_frame( path_challenge, data, 10UL )==9UL );

data[0] = 0x1b;
FD_TEST( fd_quic_decode_path_response_frame( path_response, data, 1UL )==FD_QUIC_PARSE_FAIL );
FD_TEST( fd_quic_decode_path_response_frame( path_response, data, 8UL )==FD_QUIC_PARSE_FAIL );
FD_TEST( fd_quic_decode_path_response_frame( path_response, data, 9UL )==9UL );
FD_TEST( fd_quic_decode_path_response_frame( path_response, data, 10UL )==9UL );
} while(0);
}

/* Test FIN arriving out of place */

int
Expand Down Expand Up @@ -535,6 +555,7 @@ main( int argc,
test_quic_stream_agave_2_0_3 ( sandbox, rng );
test_quic_ping_frame ( sandbox, rng );
test_quic_server_alpn_fail ( sandbox, rng );
test_quic_parse_path_challenge();

/* Wind down */

Expand Down

0 comments on commit aca5c23

Please sign in to comment.