Commit 8e4f37d
committed
zsock: Check native socket in zsock_resolve before ZMQ socket
Especially in Windows (at least on builds using MSVC), `zsock_resolve`
randomly (but quite often) segfaults if the passed pointer is actually
pointing to a native `SOCKET` instead of zactor, zsock, or a ZMQ socket.
This happens because `zmq_getsockopt` tries to check if, after casting,
the pointer points to an object with specific tag (`check_tag()`).
Unfortunately, reading this area of memory is often an access violation
if the pointer actually pointed to a `SOCKET` (which is a smaller data
type).
It seems that checking if the pointer is to a native socket first before
checking if it is a ZMQ socket fixes this, so these checks were
reordered.
Resolves #23001 parent 2955e21 commit 8e4f37d
1 file changed
Lines changed: 10 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1845 | 1845 | | |
1846 | 1846 | | |
1847 | 1847 | | |
1848 | | - | |
1849 | | - | |
1850 | | - | |
1851 | | - | |
1852 | | - | |
1853 | | - | |
1854 | 1848 | | |
| 1849 | + | |
| 1850 | + | |
| 1851 | + | |
1855 | 1852 | | |
1856 | 1853 | | |
1857 | 1854 | | |
| |||
1866 | 1863 | | |
1867 | 1864 | | |
1868 | 1865 | | |
| 1866 | + | |
| 1867 | + | |
| 1868 | + | |
| 1869 | + | |
| 1870 | + | |
| 1871 | + | |
| 1872 | + | |
1869 | 1873 | | |
1870 | 1874 | | |
1871 | 1875 | | |
| |||
0 commit comments