v2ray-core icon indicating copy to clipboard operation
v2ray-core copied to clipboard

Fix: Charset of `ACAutomationMatcherGroup` should accept all ASCII characters

Open Vigilans opened this issue 3 years ago • 1 comments

In previous ac automation implementations, we thought a domain name would only contain valid characters (the LDH subset) (because DNS and http requests should validate the domain beforehand).

But actually this is not the case, and doing nslookup { <v2ray-dns> would cause ACAutomationMatcherGroup to fail because acCharset does not contain a index mapping for character { (whose code index is larger than z). This has caused a in-daily-use v2ray dns to crash.

Therefore, this PR changes acCharset to be 256 elements long, to be able to cover the whole range of a byte of character. All invalid characters are mapped to a reserved index 0.

Vigilans avatar Sep 16 '22 09:09 Vigilans

Codecov Report

Base: 38.97% // Head: 38.85% // Decreases project coverage by -0.12% :warning:

Coverage data is based on head (f8ce89f) compared to base (305661c). Patch has no changes to coverable lines.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1988      +/-   ##
==========================================
- Coverage   38.97%   38.85%   -0.13%     
==========================================
  Files         616      611       -5     
  Lines       36442    36367      -75     
==========================================
- Hits        14204    14129      -75     
  Misses      20652    20652              
  Partials     1586     1586              
Impacted Files Coverage Δ
common/strmatcher/matchergroup_ac_automation.go 100.00% <ø> (ø)
app/proxyman/outbound/errors.generated.go 0.00% <0.00%> (-100.00%) :arrow_down:
common/task/task.go 88.88% <0.00%> (-7.41%) :arrow_down:
testing/servers/tcp/tcp.go 81.81% <0.00%> (-5.46%) :arrow_down:
testing/scenarios/common.go 75.00% <0.00%> (-4.29%) :arrow_down:
app/proxyman/outbound/handler.go 36.61% <0.00%> (-4.23%) :arrow_down:
transport/internet/kcp/dialer.go 80.39% <0.00%> (-3.93%) :arrow_down:
transport/internet/websocket/connection.go 16.51% <0.00%> (-3.67%) :arrow_down:
transport/internet/kcp/connection.go 69.61% <0.00%> (-2.21%) :arrow_down:
common/session/context.go 56.66% <0.00%> (-1.67%) :arrow_down:
... and 8 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

codecov-commenter avatar Sep 16 '22 09:09 codecov-commenter