Skip to content

selector: avoid nil deref when no outbound is selected - #4102

Open
SAY-5 wants to merge 240 commits into
SagerNet:testingfrom
SAY-5:say5/selector-nil-selected-3917
Open

selector: avoid nil deref when no outbound is selected#4102
SAY-5 wants to merge 240 commits into
SagerNet:testingfrom
SAY-5:say5/selector-nil-selected-3917

Conversation

@SAY-5

@SAY-5 SAY-5 commented May 2, 2026

Copy link
Copy Markdown

Fixes #3917.

Selector.DialContext/ListenPacket/NewConnection/NewPacketConnection/NewDirectRouteConnection all called s.selected.Load() and immediately dereferenced the result. Network() and Now() already nil-check; the connection-side methods didn't. After SFA disconnect+reconnect, selected can be nil and the next dial panics, guard each callsite.

@nekohasekai
nekohasekai force-pushed the testing branch 2 times, most recently from 8f15b13 to 9ee56ae Compare May 3, 2026 01:08
@nekohasekai
nekohasekai force-pushed the testing branch 6 times, most recently from 057f540 to 6b07a22 Compare May 15, 2026 05:29
@nekohasekai
nekohasekai force-pushed the testing branch 4 times, most recently from 82e84f9 to abac453 Compare May 21, 2026 04:55
@SAY-5
SAY-5 force-pushed the say5/selector-nil-selected-3917 branch from b51af84 to d379866 Compare May 21, 2026 05:45
@SAY-5
SAY-5 force-pushed the say5/selector-nil-selected-3917 branch from d379866 to 174db70 Compare May 21, 2026 19:17
@nekohasekai
nekohasekai force-pushed the testing branch 4 times, most recently from 2141845 to b6c416b Compare May 26, 2026 09:45
@nekohasekai
nekohasekai force-pushed the testing branch 3 times, most recently from de161cf to 83b7304 Compare June 3, 2026 05:05
@nekohasekai
nekohasekai force-pushed the testing branch 7 times, most recently from 1ed57eb to 8247670 Compare June 13, 2026 15:01
nekohasekai and others added 29 commits August 12, 2026 13:29
Batched darwin packet I/O now also covers connected sockets on iOS.
- Limit SubscribeGroups and SubscribeOutbounds to one push per 250ms, coalescing bursts of URLTest updates
Signed-off-by: Sai Asish Y <say.apm35@gmail.com>
@SAY-5

SAY-5 commented Aug 16, 2026

Copy link
Copy Markdown
Author

Rebased on testing. NewDirectRouteConnection is gone from Selector upstream so that guard dropped out, the other four still load selected without a nil check.

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

Successfully merging this pull request may close these issues.

Selector outbound causes nil pointer panic on reconnect when used as Tailscale endpoint detour (SFA)

5 participants