emscripten-core / emscripten-core/emscripten
emscripten_websocket_send_binary() dataLength can be negative for getpeername() and getsockname()
Open
- Dominant language
- C++
- Stars
- 27.6k
- Forks
- 3.6k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 105
Description
On the following lines, subtraction of MAX_SOCKADDR_SIZE from the dataLength parameter causes its value to become negative, which causes the unpacking of the data on the proxy to fail.
https://github.com/emscripten-core/emscripten/blob/d5ef6937fe395488e23a82c1e582a7ea5c2dab83/system/lib/websocket/websocket_to_posix_socket.c#L495
https://github.com/emscripten-core/emscripten/blob/d5ef6937fe395488e23a82c1e582a7ea5c2dab83/system/lib/websocket/websocket_to_posix_socket.c#L534
I have worked around the issue, for now, by removing the '- MAX_SOCKADDR_SIZE'.
Is that the right fix?
Contributor guide
Assessment
This issue has not been assessed yet.