-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
decode_variable_int func bug #19
Comments
Wow yeah, I totally got the implementation wrong there, good catch! If you'd like, feel free to open a PR with the fix and a test case for this, otherwise I can get to it a bit later today. Thanks for the bug report! |
All right, I'll open the PR! |
TakuKitamura
added a commit
to TakuKitamura/mqtt-broker
that referenced
this issue
May 19, 2020
TakuKitamura
added a commit
to TakuKitamura/mqtt-broker
that referenced
this issue
May 19, 2020
Thanks again for the PR! I merged it and published a new version on crates |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
According to [1.5.5 Variable Byte Integer] of the MQTT5.0 specification, the algorithm to decode a variable byte integer type is as follows
Algorithm to decode a variable byte integer type
Original
However, the implementation of decoding variable-byte integer types is wrong.
Specifically, the implementation of the arithmetic part of "multiplier" is different.
With the current implementation, if the client sends a PUBLISH packet with a variable-byte integer size of 2,097,152 (0x80,0x80,0x80,0x01) to 268,435,455 (0xFF,0xFF,0xFF,0xFF,0x7F), the following error will be output.
Error while reading frame: InvalidRemainingLength
Fixed
The revision is like this.
Please let me know if I'm saying something wrong.
The text was updated successfully, but these errors were encountered: