You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Panic in DomainRule::Wildcard::matches — "attempt to subtract with overflow" when hostname shorter than wildcard #1223
Then send a request whose Host header is shorter than the wildcard:
GET / HTTP/1.1
Host: a.b
The router iterates over all DomainRules for the listener and, when it hits
the wildcard entry, computes 3 - 24 → overflow → panic in debug builds
(release builds happen to be safe because the short-circuit && prevents the
out-of-bounds slice from being evaluated, but the arithmetic is still broken).
In my case I hit this accidentally: the wildcard route was for domain A, but
a different request arrived for domain B on the same listener. During route
matching the wildcard rule was evaluated against B's short Host and panicked.
Called via sozu-command-lib 1.1.1 frontend routing
Rust: rustc 1.94.1
Debug build (panic visible). Release builds don't panic here because the
short-circuit && returns false before the wrapped index is used as a slice
bound, but this correctness is accidental.
Activity
FlorentinDUBOIS commentedon Apr 21, 2026
Thanks for reporting the issue! I will take a look.
fix(router): prevent panic in DomainRule::Wildcard::matches
chore(changelog): collapse 3 Unreleased sections + drop emoji headers
fix(router): prevent panic in DomainRule::Wildcard::matches
chore(changelog): collapse 3 Unreleased sections + drop emoji headers