GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||
GeezerVison is showing github.com — MqttEncoder: Reject Variable Byte Integers larger than 268435455 by normanmaurer · Pull Request #17984 · netty/netty Conversation
Member
Motivation: The MQTT remaining length, the properties length and the Subscription Modifications:
Result: MqttEncoder no longer produces packets with an invalid Variable Byte
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactionsMotivation: The MQTT remaining length, the properties length and the Subscription Identifier property are Variable Byte Integers which use at most four bytes and so can not be larger than 268,435,455. MqttEncoder never checked this. getVariableLengthInt() reported four bytes for every value above 2,097,151 while writeVariableLengthInt() wrote as many bytes as the value needed. For a larger value the output buffer was sized too small and a fifth length byte was written, so the packet was not framed correctly. A computed size that overflowed int was handled as a negative value and encoded the same way. Modifications: - Throw an EncoderException from getVariableLengthInt() and writeVariableLengthInt() if the value is negative or larger than 268,435,455. - Compute the CONNACK fixed header size via getVariableLengthInt() so the check also runs before the output buffer is allocated. - Add unit tests. Result: MqttEncoder no longer produces packets with an invalid Variable Byte Integer.
Member
Author
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
|
There was an error while loading. Please reload this page.
✅ All tests passed ✅🏷️ Commit: 5f16cf6 Learn more about TestLens at testlens.app/docs. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Could not create auto-port PR. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
4.1: #18025 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Auto-port PR for 5.0: #18027 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
… 268435455 (#18027) Auto-port of #17984 to 5.0 Cherry-picked commit: bd41b40 --- Motivation: The MQTT remaining length, the properties length and the Subscription Identifier property are Variable Byte Integers which use at most four bytes and so can not be larger than 268,435,455. MqttEncoder never checked this. getVariableLengthInt() reported four bytes for every value above 2,097,151 while writeVariableLengthInt() wrote as many bytes as the value needed. For a larger value the output buffer was sized too small and a fifth length byte was written, so the packet was not framed correctly. A computed size that overflowed int was handled as a negative value and encoded the same way. Modifications: - Throw an EncoderException from getVariableLengthInt() and writeVariableLengthInt() if the value is negative or larger than 268,435,455. - Compute the CONNACK fixed header size via getVariableLengthInt() so the check also runs before the output buffer is allocated. - Add unit tests. Result: MqttEncoder no longer produces packets with an invalid Variable Byte Integer. Co-authored-by: Norman Maurer <[email protected]>
…35455 (#17984) (#18025) Motivation: The MQTT remaining length, the properties length and the Subscription Identifier property are Variable Byte Integers which use at most four bytes and so can not be larger than 268,435,455. MqttEncoder never checked this. getVariableLengthInt() reported four bytes for every value above 2,097,151 while writeVariableLengthInt() wrote as many bytes as the value needed. For a larger value the output buffer was sized too small and a fifth length byte was written, so the packet was not framed correctly. A computed size that overflowed int was handled as a negative value and encoded the same way. Modifications: - Throw an EncoderException from getVariableLengthInt() and writeVariableLengthInt() if the value is negative or larger than 268,435,455. - Compute the CONNACK fixed header size via getVariableLengthInt() so the check also runs before the output buffer is allocated. - Add unit tests. Result: MqttEncoder no longer produces packets with an invalid Variable Byte Integer.
…35455 (netty#17984) (netty#18025) Motivation: The MQTT remaining length, the properties length and the Subscription Identifier property are Variable Byte Integers which use at most four bytes and so can not be larger than 268,435,455. MqttEncoder never checked this. getVariableLengthInt() reported four bytes for every value above 2,097,151 while writeVariableLengthInt() wrote as many bytes as the value needed. For a larger value the output buffer was sized too small and a fifth length byte was written, so the packet was not framed correctly. A computed size that overflowed int was handled as a negative value and encoded the same way. Modifications: - Throw an EncoderException from getVariableLengthInt() and writeVariableLengthInt() if the value is negative or larger than 268,435,455. - Compute the CONNACK fixed header size via getVariableLengthInt() so the check also runs before the output buffer is allocated. - Add unit tests. Result: MqttEncoder no longer produces packets with an invalid Variable Byte Integer.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.