diff options
| author | zeertzjq <zeertzjq@outlook.com> | 2025-11-01 08:20:46 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-11-01 08:20:46 +0800 |
| commit | d077a24f5c0bef70b9cf5b11276f364dab930a64 (patch) | |
| tree | a4ac540c5b698156a836e46143fc6a5ae75ce1b7 /runtime/lua/vim/_stringbuffer.lua | |
| parent | 1fddd74da7428e38b79ccb817dbd6952ff1d8ac6 (diff) | |
| download | rneovim-d077a24f5c0bef70b9cf5b11276f364dab930a64.tar.gz rneovim-d077a24f5c0bef70b9cf5b11276f364dab930a64.tar.bz2 rneovim-d077a24f5c0bef70b9cf5b11276f364dab930a64.zip | |
fix(socket): avoid stack-use-after-return after timeout (#36405)
Problem:
In socket_connect(), if connecting to the given TCP address times out,
libuv is still trying to connect to the address, and connect_cb may be
called when running the libuv event loop after the `status` variable
referenced by `req.data` goes out of scope.
Solution:
Close the uv_tcp_t handle and wait for connect_cb to be called before
retrying or failing in socket_connect(). This also avoid leaking libuv
handles.
The tests added here only check that the non-timeout case still works,
as checking the timeout case is very hard without modifications to the
code. Removing the first LOOP_PROCESS_EVENT_UNTIL() in socket_connect()
(the one with the timeout) is a way to check that manually.
Also add a comment about the cause of the ASAN error in #34586.
Diffstat (limited to 'runtime/lua/vim/_stringbuffer.lua')
0 files changed, 0 insertions, 0 deletions