XHTTP packet-up: `scMaxEachPostBytes` of 0 or a range starting at 0 (`"0-100"`) panics at the first dial; `-test` passes

Aperta
#7,558 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
66/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
go
Ambito
networking

Direzione di ricerca

Start with transport/internet/splithttp/dialer.go at the panic site around line 457, then trace how scMaxEachPostBytes is parsed and validated by the config builder. Check the config tests and add coverage for 0 and "0-100"; done means -test rejects these values with a config error and dialing no longer panics.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Integrity requirements

  • I read the issue template.
  • I confirm I read the documentation and did not pile up options.
  • Complete configs and logs are provided below.
  • I searched issues and found no similar ones.
  • Reproduced on the latest release.

Description

Version: Xray 26.11.9 (Xray, Penetrates Everything.) 676eaf6 (go1.27.3 linux/amd64), the v26.11.9 release Xray-linux-64.zip (sha256 b651f7e1d9966ee2c1b1ee1bf8b52c72771824d3065dce96bbc8bcc19ed95f82). The panic site is also unchanged on main at 919d0ae (2026-11-30).

transport/internet/splithttp/dialer.go:457 (release; :460 on main) does if scMaxEachPostBytes.From <= 0 { panic("scMaxEachPostBytes should be bigger than 0") } at dial time, but the conf builder accepts these values ("0-100", -1), and -test prints Configuration OK. A config value error should be reported when the config is loaded, not as a panic on the first connection, and the process dies for every user of that core.

Reproduction Method

Save the client config below as cfg.json and the server config as server.json (both on 127.0.0.1).

# server: xray run -c server.json ; client: xray run -c client.json, then
curl -x socks5h://127.0.0.1:10808 http://127.0.0.1:20001/

Expected result: xray run -test and xray run fail with a config error for scMaxEachPostBytes, before any connection; no panic.

(xray run -test on the client config prints Configuration OK, exit 0.)

Client config


{
  "log": {
    "loglevel": "warning"
  },
  "inbounds": [
    {
      "listen": "127.0.0.1",
      "port": 10808,
      "protocol": "socks"
    }
  ],
  "outbounds": [
    {
      "protocol": "vless",
      "settings": {
        "vnext": [
          {
            "address": "127.0.0.1",
            "port": 20001,
            "users": [
              {
                "id": "c20965b7-c354-405b-a3ef-f886415c9181",
                "encryption": "mlkem768x25519plus.native.0rtt.nRxXGka6BdFGEXRFjltK8zrAIpkpA_I4ognJS0Vjn3ygH0QU7-gZrugt9skhLYFQCya7v1wHDth6NzuUV9Foc1u9syhDW4xSE5lxFXJMURIqAKsw2EAC9uNgCWqGX1q2_usCx9WVbIh0nheh6ahRI4M0pfkMjOQGKsVzZSxxaZABzBisKPAKApqusZphcHjIAPCASIkw47tXI2gz_BKxTsQa2XZR9tssBgOif6etOgefLMZmbFa19KpLuOUH9EAQoJmLmfSpsHFk_IGajGOQ6sNKPOguN4Jz-BtG-LuGHNtbOPqLRIEhFHicr0Yt71YOR2Z-UqkoGpR7iZcNaqGHMwt3wrwjQyXOeaAp5uIz_ats09s7A2RZcUlLUDoDLUd6t7gK-swJ2-IuUtcme5oRrrNGOjHM_dh-XsrHIHcZ0IlW-ihMp-eAb0p_S0iVc8RnLlCt9Qunvge5ymPIacB6ekeb38SmRVihwPXMywVtM0O8ODlAYQi57yrBqoAaXqyTsvZZW1zLARKSq0KLRxCsppWiH_rM7EUMA5oHxDa0hDFzu2WvXxrGiodGW_WS1aCjYrJ9Jwdna_KPA1iv3mcz5HtBmnqsBLE7ZEY5CQIHi-CViOZ4aoG2CXZFuahyTEK-JzY0EqalyQehLHkgjihq3qyYzkqoNNQf3PmMRrFj95iHqgBv5LrE77skHcwFrtVSnXhw2gcRj6ctspWAlyNAEMibPZFgpswOYaVnRNwla5cV2rl3W1NtmfpIvwQrVrlMtZMGtiOzPQRk7USHwcEs6IEcJOKKxnbDJ1wlGaUfXPmiIiKjAletE5kVvPNCabq0_voYZivMVSBsk3E0XVIxkQZybdK80RQYWoGUWizLgAAc3xIEv4wGeDaa-ukXTpaP3NdjKdVlGpeG7tieT5si7QmFLqB5kVJFYcJvE4dHOEtRIwSnNdDOvzNszjtHBJM7izmXXcONV_Ct7hRMV3hitzgFSlVuI-TMBeViHCiePTwenXJJzyyK5aQR67ETBMUd_8WHfWtDGcBPb5tJvsYzrkR2OwtTheNm-9UO8AWmhlRN59CmAERVvPOGjbpuArzCRSTHhXTOyHee7ByhSmyYkug0qkqhLBeMUwlfxVy514NkkXRjT2tPNprJu2MA8MeoCyRCFsBMpIQAnTUVineuFWdAmCC4tykFyrstuRVn9FiIAsOX2UoMSMsBG-EyK1prbfdaWIk3lmUeRJddUHtuzsmhssw1NhZsj8BIAzgRSyNoACyUN1SZ15az3lzILJcQ6oYZwdw22sKrnbF9SdfIpeytF2I0MFhGdYGmC8wnUQIfAAS6Hmu8xJUww8yLV3y0gqJJu3ZZmScR5sNKK8bKotkgBhVc2eAZEesBsst4HfqG9dMusSg1CgynrNcqfVwUnMNjtpMoYnbFBjKQ6wx6guQ5YaYR12S-AeQzh9ZeEPmmLZpz00CTh2FUfxg5YlSIKAwZr7KA1cxLmnuo35RgWcVhSUvK6vA10hin69S5VimHXSU840scKmN9GQmmspla0vSDWbNDin7msk1nr-PxbXrV0021EQy81R_P65A4QG4"
              }
            ]
          }
        ]
      },
      "streamSettings": {
        "network": "xhttp",
        "xhttpSettings": {
          "path": "/p",
          "mode": "packet-up",
          "scMaxEachPostBytes": "0-100"
        }
      }
    }
  ]
}

Server config


{
  "log": {
    "loglevel": "warning"
  },
  "inbounds": [
    {
      "listen": "127.0.0.1",
      "port": 20001,
      "protocol": "vless",
      "settings": {
        "clients": [
          {
            "id": "c20965b7-c354-405b-a3ef-f886415c9181"
          }
        ],
        "decryption": "mlkem768x25519plus.native.600s.mKKB2hh6ttyVKwqg9SccKO1WYEAP8KmAiIBRYDTBrton62Xv7UIKMjjzxjsoAC_oAb7uENPtbKTTMPptqDe5OA"
      },
      "streamSettings": {
        "network": "xhttp",
        "xhttpSettings": {
          "path": "/p"
        }
      }
    }
  ],
  "outbounds": [
    {
      "protocol": "freedom"
    }
  ]
}

Client log

Full output of the panicking process (ends with the exit code):


Xray 26.11.9 (Xray, Penetrates Everything.) 676eaf6 (go1.27.3 linux/amd64)
A unified platform for anti-censorship.
[Info] infra/conf/serial: Reading config: &{Name:/tmp/repro/cfg/scmax-run.json Format:json}
[Warning] core: Xray 26.11.9 started
from tcp:127.0.0.1:58278 accepted tcp:127.0.0.1:20001
panic: `scMaxEachPostBytes` should be bigger than 0

goroutine 50 [running]:
github.com/xtls/xray-core/transport/internet/splithttp.Dial({0x24c9158, 0x381d77c5590}, {{0x24c9628, 0x381d791adb8}, 0x4e21, 0x2}, 0x381d77c6f50)
github.com/xtls/xray-core/transport/internet/splithttp/dialer.go:457 +0x1979
github.com/xtls/xray-core/transport/internet.Dial({0x24c9158, 0x381d77c5590}, {{0x24c9628?, 0x381d791adb8?}, 0x78f8?, 0x759d?}, 0x381d79961e0?)
github.com/xtls/xray-core/transport/internet/dialer.go:63 +0x168
github.com/xtls/xray-core/app/proxyman/outbound.(*Handler).Dial(0x381d796fc80, {0x24c9158?, 0x381d77c5590?}, {{0x24c9628?, 0x381d791adb8?}, 0xfeb0?, 0x0?})
github.com/xtls/xray-core/app/proxyman/outbound/handler.go:275 +0x11d
github.com/xtls/xray-core/proxy/vless/outbound.(*Handler).Process.func2()
github.com/xtls/xray-core/proxy/vless/outbound/outbound.go:192 +0x4c
github.com/xtls/xray-core/common/retry.(*retryer).On(0x381d78c7578, 0x381d78c75c0)
github.com/xtls/xray-core/common/retry/retry.go:27 +0xc3
github.com/xtls/xray-core/proxy/vless/outbound.(*Handler).Process(0x381d7996690, {0x24c9158, 0x381d77c5590}, 0x381d797c140, {0x24c7308, 0x381d796fc80})
github.com/xtls/xray-core/proxy/vless/outbound/outbound.go:190 +0x3a5
github.com/xtls/xray-core/app/proxyman/outbound.(*Handler).Dispatch(0x381d796fc80, {0x24c9158, 0x381d77c5590}, 0x381d797c140)
github.com/xtls/xray-core/app/proxyman/outbound/handler.go:239 +0x98a
github.com/xtls/xray-core/app/dispatcher.(*DefaultDispatcher).routedDispatch(0x381d79964b0, {0x24c9158, 0x381d77c5590}, 0x381d797c140, {{0x24c9628, 0x381d75b41b4}, 0x4e21, 0x2})
github.com/xtls/xray-core/app/dispatcher/default.go:507 +0xc52
github.com/xtls/xray-core/app/dispatcher.(*DefaultDispatcher).DispatchLink(0x381d79964b0, {0x24c9158, 0x381d77c5590}, {{0x24c9628?, 0x381d75b41b4?}, 0x8?, 0x381?}, 0x381d797c140)
github.com/xtls/xray-core/app/dispatcher/default.go:344 +0x506
github.com/xtls/xray-core/common/mux.(*Server).DispatchLink(0x20?, {0x24c9158?, 0x381d77c5590?}, {{0x24c9628?, 0x381d75b41b4?}, 0xc080?, 0x381?}, 0x2?)
github.com/xtls/xray-core/common/mux/server.go:64 +0xda
github.com/xtls/xray-core/proxy/socks.(*Server).processTCP(0x381d7973710, {0x24c9158, 0x381d77c45d0}, {0x759d72b4d0f0, 0x381d7682010}, {0x24ca4f0, 0x381d75fca50}, {0x381d75b41a8, 0x1, 0x1})
github.com/xtls/xray-core/proxy/socks/server.go:157 +0xf4b
github.com/xtls/xray-core/proxy/socks.(*Server).Process(0x381d7973710, {0x24c9158, 0x381d77c45d0}, 0x2, {0x759d72b4d0f0, 0x381d7682010}, {0x24ca4f0, 0x381d75fca50})
github.com/xtls/xray-core/proxy/socks/server.go:91 +0x2a5
github.com/xtls/xray-core/app/proxyman/inbound.(*tcpWorker).callback(0x381d7998000, {0x759d72b4d0f0, 0x381d7682010})
github.com/xtls/xray-core/app/proxyman/inbound/worker.go:123 +0xde3
created by github.com/xtls/xray-core/app/proxyman/inbound.(*tcpWorker).Start.func1 in goroutine 81
github.com/xtls/xray-core/app/proxyman/inbound/worker.go:142 +0x86
exit=2

Server log

Server started normally, no warnings (loglevel: warning).

Lingua principale
Go
Stelle
43.3k
Fork
6.2k
Merge medio
2g 11h
PR unite (30g)
55

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di XTLS/Xray-core

Tutte le issue di XTLS/Xray-core

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.