Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix Buffer Out of Bounds Error #100

Merged
merged 2 commits into from
Feb 12, 2021

Conversation

bkp7
Copy link
Contributor

@bkp7 bkp7 commented Feb 9, 2021

Fix bug in _parseVarByteNum() function causing Buffer Out of Bounds Error.

Added Tests.

Also refactored the testParseGenerateDefaults() test function to separate out a new testParseOnly() which can be used directly.

Fixes #99, fixes #98, closes #78, fixes mqttjs/MQTT.js#1073, fixes mqttjs/MQTT.js#993, fixes mqttjs/MQTT.js#1176

Possible fix to mqttjs/MQTT.js#1228 which has this function in the call stack. Unfortunately no specific test provided in that issue to prove it's fixed.

Probable fix to #72, but gist and test not longer present to check it.

…teDefaults() to allow just the parsing to be performed on its own.
…nerate the mqtt bytes, and then parse that buffer to a full packet object with defaults shown.

Add an additional testParseAndGenerate function which takes a packet and an mqtt bytes and tests they Parse and Generate in both directions.
Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mcollina mcollina merged commit b6b73ba into mqttjs:master Feb 12, 2021
@bkp7 bkp7 deleted the fix-parseVarByteNum-buffer-error branch February 12, 2021 19:58
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
2 participants