Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] VMESS节点字段内容异常导致panic #1225

Closed
5 of 6 tasks
fzdy-zz opened this issue Apr 26, 2024 · 4 comments
Closed
5 of 6 tasks

[Bug] VMESS节点字段内容异常导致panic #1225

fzdy-zz opened this issue Apr 26, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@fzdy-zz
Copy link

fzdy-zz commented Apr 26, 2024

Verify steps

  • 确保你使用的是本仓库最新的的 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.
  • 我已经在 Issue Tracker 中找过我要提出的问题 I have searched on the issue tracker for a related issue.
  • 我已经使用 Alpha 分支版本测试过,问题依旧存在 I have tested using the dev branch, and the issue still exists.
  • 我已经仔细看过 Documentation 并无法自行解决问题 I have read the documentation and was unable to solve the issue.
  • 这是 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

mihomo@v1.11.9-0.20240425034853-8ff56b5bb83c

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/mihomo@v1.11.9-0.20240425034853-8ff56b5bb83c/transport/vmess/http.go:71 +0x38c
github.com/metacubex/sing-vmess.(*rawClientConn).writeHandshake(0x4004385040, {0x0, 0x0, 0x0})
        github.com/metacubex/sing-vmess@v0.1.9-0.20231207122118-72303677451f/client.go:273 +0x8dc
github.com/metacubex/sing-vmess.(*Client).DialConn(0x12d4f81?, {0x152ac90?, 0x40019388a0?}, {{{0x0, 0x0}, 0x0}, 0x1bb, {0x12d4f81, 0xf}})
        github.com/metacubex/sing-vmess@v0.1.9-0.20231207122118-72303677451f/client.go:74 +0xf4
github.com/metacubex/mihomo/adapter/outbound.(*Vmess).streamConn(0x400184a140, {0x152ac90, 0x40019388a0}, 0x4002fb3600)
        github.com/metacubex/mihomo@v1.11.9-0.20240425034853-8ff56b5bb83c/adapter/outbound/vmess.go:269 +0x95c
github.com/metacubex/mihomo/adapter/outbound.(*Vmess).StreamConnContext(0x400184a140, {0x151eb88, 0x40004fa230}, {0x152a3f8, 0x4002254f48}, 0x4002fb3600)
        github.com/metacubex/mihomo@v1.11.9-0.20240425034853-8ff56b5bb83c/adapter/outbound/vmess.go:227 +0x7ac
github.com/metacubex/mihomo/adapter/outbound.(*Vmess).DialContextWithDialer(0x400184a140, {0x151eb88, 0x40004fa230}, {0x1514968?, 0x4002dd7d40?}, 0x4002fb3600)
        github.com/metacubex/mihomo@v1.11.9-0.20240425034853-8ff56b5bb83c/adapter/outbound/vmess.go:318 +0x1e8
github.com/metacubex/mihomo/adapter/outbound.(*Vmess).DialContext(0x400184a140, {0x151eb88, 0x40004fa230}, 0x4002fb3600, {0x0?, 0x0?, 0x40029b78d8?})
        github.com/metacubex/mihomo@v1.11.9-0.20240425034853-8ff56b5bb83c/adapter/outbound/vmess.go:298 +0x26c
github.com/metacubex/mihomo/adapter.(*Proxy).DialContext(0x0?, {0x151eb88?, 0x40004fa230?}, 0x0?, {0x0?, 0x0?, 0x0?})
        github.com/metacubex/mihomo@v1.11.9-0.20240425034853-8ff56b5bb83c/adapter/adapter.go:58 +0x34
@fzdy-zz fzdy-zz added the bug Something isn't working label Apr 26, 2024
@fakeboboliu
Copy link

fakeboboliu commented Apr 26, 2024

req, _ := http.NewRequest(utils.EmptyOr(hc.cfg.Method, http.MethodGet), u, bytes.NewBuffer(b))

应该是这里没做错误处理,req 为 nil,导致不合法的 url 使程序 crash

@fzdy-zz
Copy link
Author

fzdy-zz commented Apr 26, 2024

req, _ := http.NewRequest(utils.EmptyOr(hc.cfg.Method, http.MethodGet), u, bytes.NewBuffer(b))

应该是这里没做错误处理,req 为 nil,导致不合法的 url 使程序 crash

能否给hc.cfg或hc.cfg.Headers 增加判断是否为nil

@fzdy-zz
Copy link
Author

fzdy-zz commented Apr 28, 2024

触发原因查明 transport/vmess/http.go:71
"headers":{"Host": 包含非域名、IP字符的 逗号","导致panic
第二个触发,因传入的path的值中,未以"/"开头导致panic

@wwqgtxx
Copy link
Collaborator

wwqgtxx commented May 21, 2024

req, _ := http.NewRequest(utils.EmptyOr(hc.cfg.Method, http.MethodGet), u, bytes.NewBuffer(b))

应该是这里没做错误处理,req 为 nil,导致不合法的 url 使程序 crash

fixed in: 87877d1

@wwqgtxx wwqgtxx closed this as completed May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants