Skip to content
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

msgpack.js -> overSized buffers generate an error, when it (probably) shouldn't #20

Open
prochat opened this issue Jul 10, 2017 · 1 comment

Comments

@prochat
Copy link

prochat commented Jul 10, 2017

Line 264:
//if (decoder.offset !== buffer.length) throw new Error((buffer.length - deco
der.offset) + " trailing bytes");

Prevents larger buffer containing a shorter msgpack content to be decoded (I commented it out).

My situation is the following: I use a block Ciphering methods to transmit data (with LoRa). Buffers are then multiple of 16, and my msg has trailing 0. I cannot remove those trailing 0 (it could be part of the msgpacked content).
I'm using msgpack.js with node-red-node-msgpack.

A workaround would be to send also mspack length in the message, that would be in contradiction with the "as short as possible" characteristic of msgpack. And I think a msgpack message in a larger buffer has to be considered as valid.

Regards,
Ph.R.

@creationix
Copy link
Owner

Yeah, the check should be optional. Could you propose an option to disable the check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants