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

Fixed bug in 16-bit frame length when buffer is a subarray #1

Merged
merged 1 commit into from
May 2, 2023

Conversation

jawj
Copy link
Owner

@jawj jawj commented May 2, 2023

I was just bitten by this issue.

Because buffer could be a subarray, the byteOffset and byteLength arguments to new DataView() are required, otherwise the bodyLength value may be written at the wrong offset.

Alternatively, it looks like it would be simpler (and I've tested it works fine) to replace the patched line with buffer.writeUInt16BE(bodyLength, 2).

I was just bitten by this issue. Because buffer could be a subarray, the `byteOffset` and `byteLength` arguments to `new DataView()` are required, otherwise the length value may be written at the wrong offset.

Alternatively, it looks like it would be simpler (and it also works) to replace the patched line with `buffer.writeUInt16BE(bodyLength, 2)`.
@jawj jawj merged commit 39146f4 into main May 2, 2023
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

Successfully merging this pull request may close these issues.

1 participant