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

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

Open
adamscott opened this issue Dec 2, 2024 · 0 comments
Open
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
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