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

Regression in PR #382: Handle transfer with no payload #388

Open
RMueAZD opened this issue Nov 24, 2022 · 1 comment
Open

Regression in PR #382: Handle transfer with no payload #388

RMueAZD opened this issue Nov 24, 2022 · 1 comment

Comments

@RMueAZD
Copy link

RMueAZD commented Nov 24, 2022

There seems to be a regression in PR #382 which was fixed in PR #349 (addressed in issue #347): Newly added line 364 in session.js is accessing <undefined>.length inside Buffer.concat() if trailing message frame has no payload.

const data = current.frames.length === 1 ? current.frames[0] : Buffer.concat(current.frames);

Problem seems to originate from line 322:

current.frames.push(frame.payload);

If the message has no payload this appends undefined to frames.

Stack trace (v3.0.1):

node:buffer:545
TypeError: Cannot read properties of undefined (reading 'length')
  at Function.concat (node:buffer:545:19)
  at Incoming.on_transfer (node_modules/rhea/lib/session.js:364:83)
  at Session.on_transfer (node_modules/rhea/lib/session.js:764:19)
  at Connection.<computed> [as on_transfer] (node_modules/rhea/lib/connection.js:855:30)
  at c.dispatch (node_modules/rhea/lib/types.js:946:33)
  at Transport.read (node_modules/rhea/lib/transport.js:117:36)
  at SaslClient.read (node_modules/rhea/lib/sasl.js:344:26)
  at Connection.input (node_modules/rhea/lib/connection.js:567:37)
  at TLSSocket.emit (node:events:527:28)
@kohtala
Copy link
Contributor

kohtala commented May 8, 2023

Hi. Sorry for the issue. I certainly did not make it on purpose. I see a fix is merged.

To help avoid creating this kind of regression, it would be great to add also test cases for these messages without payload.

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