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

Handle zero-length bundles #82

Open
jwt27 opened this issue Jul 7, 2024 · 0 comments
Open

Handle zero-length bundles #82

jwt27 opened this issue Jul 7, 2024 · 0 comments

Comments

@jwt27
Copy link

jwt27 commented Jul 7, 2024

Receiving empty bundles doesn't seem to work - the element size is parsed, but never used, and it ends up throwing an exception in the Message address parser.

A quick fix could be:

--- a/src/bundle.js
+++ b/src/bundle.js
@@ -150,6 +150,9 @@ export default class Bundle {

       offset = size.unpack(dataView, offset)

+      if (size.value == 0)
+        continue;
+
       // check if Packet is a Bundle or a Message
       let item
       head.unpack(dataView, offset)

Although I think a more "correct" approach would involve using a new DataView for each bundle element.

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

1 participant