emscripten-core / emscripten

Emscripten: An LLVM-to-WebAssembly Compiler
Other
25.91k stars 3.32k forks source link

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

Open adamscott opened 1 day ago

adamscott commented 1 day ago

[!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

https://github.com/emscripten-core/emscripten/blob/06cebfca51f908d3bc6897113330e45a77010db2/src/library_sockfs.js#L632-L647

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