LengthDelimitedCodec::length_field_type()/length_field_len() should also update max_frame_length #5080
Labels
A-tokio-util
Area: The tokio-util crate
C-bug
Category: This is a bug.
M-codec
Module: tokio-util/codec
Version tokio-util v0.7.2
Platform Win7
Description
Currently
LengthDelimitedCodec
sEncoder
truncates frame length, which leads to corrupted data (e.g. 6Mb frame prefixed with 2-bytes length).I expected to see this happen:
length_field_type::<u16>()
(orlength_field_len(2)
) should also setmax_frame_length
tomin(65535, max_frame_length)
max_frame_length(N)
should also updatelength_field_len
to smallest M such thatN < (1 << 8*M)
(probably not a good idea since it will change network-lvl presentation... maybe panic, iflength_field_len
is too small to accomodateN
?)The text was updated successfully, but these errors were encountered: