tokio-util
's LengthDelimitedCodec
doesn't adjust decoded length before checking overflow
#4815
Labels
A-tokio-util
Area: The tokio-util crate
C-bug
Category: This is a bug.
M-codec
Module: tokio-util/codec
S-blocked
Status: marked as blocked ❌ on something else such as a PR or other implementation work.
Version
tokio-util = { version = "0.7.3", features = ["codec"] }
Platform
Windows
Description
When
.length_adjustment()
is set to a negative value, a encoded max-sized frame cannot be decoded because overflow is checked before making length adjustment to the decoded length.[short summary of the bug]
I tried this code:
I expected to see this happen:
I expect that the codec is able to decode the bytes that are encoded by essentially the same codec.
Instead, this happened:
The decoding would fail when it checks for overflow
tokio/tokio-util/src/codec/length_delimited.rs
Line 496 in 4daeea8
The text was updated successfully, but these errors were encountered: