mihomo
mihomo copied to clipboard
[Bug] VMESS节点字段内容异常导致panic
Verify steps
- [X] 确保你使用的是本仓库最新的的 mihomo 或 mihomo Alpha 版本 Ensure you are using the latest version of Mihomo or Mihomo Alpha from this repository.
- [ ] 如果你可以自己 debug 并解决的话,提交 PR 吧 Is this something you can debug and fix? Send a pull request! Bug fixes and documentation fixes are welcome.
- [X] 我已经在 Issue Tracker 中找过我要提出的问题 I have searched on the issue tracker for a related issue.
- [X] 我已经使用 Alpha 分支版本测试过,问题依旧存在 I have tested using the dev branch, and the issue still exists.
- [X] 我已经仔细看过 Documentation 并无法自行解决问题 I have read the documentation and was unable to solve the issue.
- [X] 这是 Mihomo 核心的问题,并非我所使用的 Mihomo 衍生版本(如 OpenMihomo、KoolMihomo 等)的特定问题 This is an issue of the Mihomo core per se, not to the derivatives of Mihomo, like OpenMihomo or KoolMihomo.
Mihomo version
What OS are you seeing the problem on?
Linux
Mihomo config
使用Wiki中的快捷配置
https://wiki.metacubex.one/example/conf/#__tabbed_1_1
Mihomo log
No response
Description
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x38 pc=0xa52efc]
goroutine 45915 [running]:
github.com/metacubex/mihomo/transport/vmess.(*httpConn).Write(0x40019388a0, {0x4004dd2780, 0x7b, 0x80})
github.com/metacubex/[email protected]/transport/vmess/http.go:71 +0x38c
github.com/metacubex/sing-vmess.(*rawClientConn).writeHandshake(0x4004385040, {0x0, 0x0, 0x0})
github.com/metacubex/[email protected]/client.go:273 +0x8dc
github.com/metacubex/sing-vmess.(*Client).DialConn(0x12d4f81?, {0x152ac90?, 0x40019388a0?}, {{{0x0, 0x0}, 0x0}, 0x1bb, {0x12d4f81, 0xf}})
github.com/metacubex/[email protected]/client.go:74 +0xf4
github.com/metacubex/mihomo/adapter/outbound.(*Vmess).streamConn(0x400184a140, {0x152ac90, 0x40019388a0}, 0x4002fb3600)
github.com/metacubex/[email protected]/adapter/outbound/vmess.go:269 +0x95c
github.com/metacubex/mihomo/adapter/outbound.(*Vmess).StreamConnContext(0x400184a140, {0x151eb88, 0x40004fa230}, {0x152a3f8, 0x4002254f48}, 0x4002fb3600)
github.com/metacubex/[email protected]/adapter/outbound/vmess.go:227 +0x7ac
github.com/metacubex/mihomo/adapter/outbound.(*Vmess).DialContextWithDialer(0x400184a140, {0x151eb88, 0x40004fa230}, {0x1514968?, 0x4002dd7d40?}, 0x4002fb3600)
github.com/metacubex/[email protected]/adapter/outbound/vmess.go:318 +0x1e8
github.com/metacubex/mihomo/adapter/outbound.(*Vmess).DialContext(0x400184a140, {0x151eb88, 0x40004fa230}, 0x4002fb3600, {0x0?, 0x0?, 0x40029b78d8?})
github.com/metacubex/[email protected]/adapter/outbound/vmess.go:298 +0x26c
github.com/metacubex/mihomo/adapter.(*Proxy).DialContext(0x0?, {0x151eb88?, 0x40004fa230?}, 0x0?, {0x0?, 0x0?, 0x0?})
github.com/metacubex/[email protected]/adapter/adapter.go:58 +0x34
https://github.com/MetaCubeX/mihomo/blob/8ff56b5bb83c5c09d592ca22fb831135cf74efac/transport/vmess/http.go#L69
应该是这里没做错误处理,req 为 nil,导致不合法的 url 使程序 crash
https://github.com/MetaCubeX/mihomo/blob/8ff56b5bb83c5c09d592ca22fb831135cf74efac/transport/vmess/http.go#L69
应该是这里没做错误处理,req 为 nil,导致不合法的 url 使程序 crash
能否给hc.cfg或hc.cfg.Headers 增加判断是否为nil
触发原因查明 transport/vmess/http.go:71 "headers":{"Host": 包含非域名、IP字符的 逗号","导致panic 第二个触发,因传入的path的值中,未以"/"开头导致panic
https://github.com/MetaCubeX/mihomo/blob/8ff56b5bb83c5c09d592ca22fb831135cf74efac/transport/vmess/http.go#L69
应该是这里没做错误处理,req 为 nil,导致不合法的 url 使程序 crash
fixed in: https://github.com/MetaCubeX/mihomo/commit/87877d1b80587edb674fcd5bb65e7345eb871b18