Incorrect bitwise calculation/combination? 'WebSocketFrame.ToArray()'
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 6.1k
- Forks
- 1.7k
- PR merge metrics
- No merged PRs in 30d
Description
I get the feeling that the following code line might be faulty:
int num = ((int) ((byte) ((int) ((byte) ((int) ((byte) ((int) ((byte) ((int) ((byte) ((int) this._fin << 1) + this._rsv1) << 1) + this._rsv2) << 1) + this._rsv3) << 4) + this._opcode) << 1) + this._mask) << 7) + (int) this._payloadLength;
And should possibly be replaced with something like this:
int num = ((byte)_fin << 15) + ((byte)_rsv1 << 14) + ((byte)_rsv2 << 13) + ((byte)_rsv3 << 12) + ((byte)_opcode << 8) + ((byte)_mask << 7) + (_payloadLength);
For the '1.0.3-rc11' version (- '1.0.2.59611'?).
Also, is the repo' for the RC version available to the public?
At least it appeared to be the case on the receiving end, and during transit (as seen via Wireshark), as the 'FIN' flag seemed unset upon arrival; although I had converted the DLL to C# code (- was something inadvertently adjusted/lost in the translation?).
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at WebSocketFrame.ToArray() and inspect the reported bitwise calculation against the WebSocket frame header layout. Reproduce serialization for a frame with FIN and the listed flags, then compare the resulting bytes with the expected header and the Wireshark observation. Done means confirming whether the implementation or the C# translation causes the incorrect FIN flag and documenting the result.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100