You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x18 pc=0x1016c5d1c]
goroutine 52 [running]:
github.com/sagernet/sing-box/dns.MessageToAddresses(0x14000226680?)
github.com/sagernet/sing-box/dns/client.go:486 +0x1c
github.com/sagernet/sing-box/dns/transport/local.(*Transport).exchangeParallel.func1({0x1020517c0?, 0x140002521e0?}, {0x14000046560, 0x1d})
github.com/sagernet/sing-box/dns/transport/local/local.go:89 +0x74
created by github.com/sagernet/sing-box/dns/transport/local.(*Transport).exchangeParallel in goroutine 69
github.com/sagernet/sing-box/dns/transport/local/local.go:103 +0x174
I speculate this happens because in exchangeParallel(), tryOneName() returns nil as value of response, which is then passed directly to MessageToAddresses()
Since MessageToAddresses() does not check for nil before accessing response.Rcode, it results in a null pointer dereference, causing the panic
Reproduction
First run sing-box and set system proxy:
% sudo sing-box run -c min.json &
Password:
+0800 2025-02-08 20:36:19 INFO network: updated default interface en0, index 14
+0800 2025-02-08 20:36:19 INFO inbound/mixed[0]: tcp server started at 127.0.0.1:5353
+0800 2025-02-08 20:36:19 INFO sing-box started (0.00s)
% sudo networksetup -setwebproxy "Thunderbolt Ethernet" 127.0.0.1 5353
% sudo networksetup -setsecurewebproxy "Thunderbolt Ethernet" 127.0.0.1 5353
Above is an interactive cli app for Safari's WebDriver, equivalent to sending a POST request to /session followed by a few to /session/{sessionId}/url with https://cn.bing.com, or opening a new Safari session in GUI and visiting the website several times
After this sing-box panicked:
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x18 pc=0x1016c5d1c]
goroutine 52 [running]:
github.com/sagernet/sing-box/dns.MessageToAddresses(0x14000226680?)
github.com/sagernet/sing-box/dns/client.go:486 +0x1c
github.com/sagernet/sing-box/dns/transport/local.(*Transport).exchangeParallel.func1({0x1020517c0?, 0x140002521e0?}, {0x14000046560, 0x1d})
github.com/sagernet/sing-box/dns/transport/local/local.go:89 +0x74
created by github.com/sagernet/sing-box/dns/transport/local.(*Transport).exchangeParallel in goroutine 69
github.com/sagernet/sing-box/dns/transport/local/local.go:103 +0x174
[1] + exit 2 sudo sing-box run -c min.json
I confirm that I have read the documentation, understand the meaning of all the configuration items I wrote, and did not pile up seemingly useful options or default values.
I confirm that I have provided the server and client configuration files and process that can be reproduced locally, instead of a complicated client configuration file that has been stripped of sensitive data.
I confirm that I have provided the simplest configuration that can be used to reproduce the error I reported, instead of depending on remote servers, TUN, graphical interface clients, or other closed-source software.
I confirm that I have provided the complete configuration files and logs, rather than just providing parts I think are useful out of confidence in my own intelligence.
The text was updated successfully, but these errors were encountered:
surinrasu
changed the title
Panic: nil pointer dereference in dns.MessageToAddresses due to missing nil check
Panic: nil pointer dereference in dns.MessageToAddressesFeb 11, 2025
Operating system
macOS
System version
15.2(24C101)
Installation type
Original sing-box Command Line
If you are using a graphical client, please provide the version of the client.
No response
Version
Description
I speculate this happens because in
exchangeParallel()
,tryOneName()
returns nil as value ofresponse
, which is then passed directly toMessageToAddresses()
Since
MessageToAddresses()
does not check for nil before accessingresponse.Rcode
, it results in a null pointer dereference, causing the panicReproduction
First run sing-box and set system proxy:
Then open some websites in browser:
Above is an interactive cli app for Safari's WebDriver, equivalent to sending a POST request to
/session
followed by a few to/session/{sessionId}/url
withhttps://cn.bing.com
, or opening a new Safari session in GUI and visiting the website several timesAfter this sing-box panicked:
min.json
:Logs
Supporter
Integrity requirements
The text was updated successfully, but these errors were encountered: