Skip to content

library_sockfs.js can access properties of undefined dest (logic flaw) #23046

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

Open
adamscott opened this issue Dec 2, 2024 · 1 comment · May be fixed by #24187
Open

library_sockfs.js can access properties of undefined dest (logic flaw) #23046

adamscott opened this issue Dec 2, 2024 · 1 comment · May be fixed by #24187
Assignees

Comments

@adamscott
Copy link

Note

This issue was unearthed by us due to what seems an issue on our side. My colleague @Faless explains it on the Godot Dev Chat. Though, the issue underlined is still a logic flaw.

Regression introduced by #22630

// if we don't have a cached connectionless UDP datagram connection, or
// the TCP socket is still connecting, queue the message to be sent upon
// connect, and lie, saying the data was sent now.
if (!dest || dest.socket.readyState !== dest.socket.OPEN) {
// if we're not connected, open a new connection
if (sock.type === {{{ cDefs.SOCK_DGRAM }}}) {
if (!dest || dest.socket.readyState === dest.socket.CLOSING || dest.socket.readyState === dest.socket.CLOSED) {
dest = SOCKFS.websocket_sock_ops.createPeer(sock, addr, port);
}
}
#if SOCKET_DEBUG
dbg(`websocket: queuing (${length} bytes): ${new Uint8Array(data)}`);
#endif
dest.msg_send_queue.push(data);
return length;
}

If dest == null and sock.type !== {{{ cDefs.SOCK_DGRAM }}} (see code above), then the following error occurs:

Capture d’écran, le 2024-12-02 à 11 27 03
@adamscott
Copy link
Author

Hello! I got this error in my side project, trying to compile https://github.com/dhewm/dhewm3. Should I create a PR?

@adamscott adamscott linked a pull request Apr 25, 2025 that will close this issue
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 a pull request may close this issue.

2 participants