SagerNet / sing-box

The universal proxy platform
https://sing-box.sagernet.org/
Other
19.28k stars 2.29k forks source link

ruleset compile fail #1940

Closed simplerick-simplefun closed 2 months ago

simplerick-simplefun commented 3 months ago

Operating system

Linux

System version

Ubuntu 22.04.4 LTS

Installation type

Original sing-box Command Line

If you are using a graphical client, please provide the version of the client.

No response

Version

sing-box version 1.10.0-alpha.21

Environment: go1.22.5 linux/amd64
Tags: with_gvisor,with_quic,with_dhcp,with_wireguard,with_ech,with_utls,with_reality_server,with_acme,with_clash_api
Revision: d46daeb790a002b13664c89b09068b6ab84f2b04
CGO: disabled

sing-box version 1.9.3

Environment: go1.22.3 linux/amd64
Tags: with_gvisor,with_quic,with_dhcp,with_wireguard,with_ech,with_utls,with_reality_server,with_acme,with_clash_api
Revision: 085f60337799afc906069b540a38368968c123e4
CGO: disabled

Description

Bug: Running sing-box rule-set compile xxx.json reports error and breaks. Also tested on Windows 11 amd64, same bug appears.

Bugged version: Tested and confirmed for 1.9.0, 1.9.3 and 1.10.0-alpha.21

No bug version: Tested and confirmed for 1.8.14

json file link: https://www.mediafire.com/file/j3ysn3aq30becu5/sites2-direct.json/file

Reproduction

  1. Download json file: https://www.mediafire.com/file/j3ysn3aq30becu5/sites2-direct.json/file
  2. run sing-box rule-set compile sites2-direct.json

Logs

panic: runtime error: index out of range [9] with length 9

goroutine 1 [running]:
github.com/sagernet/sing/common/domain.newSuccinctSet({0xc004224000, 0x27c2a, 0xc0001da930?})
        github.com/sagernet/sing@v0.4.1/common/domain/set.go:31 +0x5c5
github.com/sagernet/sing/common/domain.NewMatcher({0xc0027f2000, 0x14030, 0x16999d0?}, {0xc004014000, 0x13dae, 0x1fdb010?})
        github.com/sagernet/sing@v0.4.1/common/domain/matcher.go:39 +0x50d
github.com/sagernet/sing-box/common/srs.writeDefaultRule({_, _}, {{0x0, 0x0, 0x0}, {0x0, 0x0, 0x0}, {0xc0027f2000, 0x14030, ...}, ...})
        github.com/sagernet/sing-box/common/srs/binary.go:236 +0x173
github.com/sagernet/sing-box/common/srs.writeRule({_, _}, {{0x1488fb3, 0x7}, {{0x0, 0x0, 0x0}, {0x0, 0x0, 0x0}, ...}, ...})
        github.com/sagernet/sing-box/common/srs/binary.go:126 +0x98
github.com/sagernet/sing-box/common/srs.Write({0x1681be0, 0xc000070188}, {{0xc0001c4000?, 0x1b6?, 0x0?}})
        github.com/sagernet/sing-box/common/srs/binary.go:96 +0x1d3
main.compileRuleSet({0x7ffcc4fef6dc, 0x12})
        github.com/sagernet/sing-box/cmd/sing-box/cmd_rule_set_compile.go:76 +0x1db
main.init.func16(0xc0000fce00?, {0xc000050ca0?, 0x4?, 0x148762d?})
        github.com/sagernet/sing-box/cmd/sing-box/cmd_rule_set_compile.go:25 +0x35
github.com/spf13/cobra.(*Command).execute(0x20660c0, {0xc000050c70, 0x1, 0x1})
        github.com/spf13/cobra@v1.8.0/command.go:987 +0xab1
github.com/spf13/cobra.(*Command).ExecuteC(0x2068340)
        github.com/spf13/cobra@v1.8.0/command.go:1115 +0x3ff
github.com/spf13/cobra.(*Command).Execute(...)
        github.com/spf13/cobra@v1.8.0/command.go:1039
main.main()
        github.com/sagernet/sing-box/cmd/sing-box/main.go:38 +0x1e

Supporter

Integrity requirements

simplerick-simplefun commented 3 months ago

fixed on version 1.10.0-alpha.22 Update: my bad, did not fix

simplerick-simplefun commented 2 months ago

Update:

Original bug is fixed on version 1.10.0-alpha.22 However, sing-box geosite export <category> now fails on every category with FATAL[0000] code <category> not exists!

Ref: https://github.com/SagerNet/sing-box/issues/1961 https://github.com/SagerNet/sing-box/issues/1960

simplerick-simplefun commented 2 months ago

Closing since this issue fixed...