Skip to content

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

Open
@adamscott

Description

@adamscott

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions