mirror of
https://gitclone.com/github.com/MetaCubeX/Clash.Meta
synced 2025-05-12 04:58:02 +08:00
fix: integer overflow in ports iteration
This commit is contained in:
parent
136d114196
commit
05e8f13a8d
@ -139,10 +139,13 @@ func (ranges IntRanges[T]) Range(f func(t T) bool) {
|
||||
}
|
||||
|
||||
for _, r := range ranges {
|
||||
for i := r.Start(); i <= r.End(); i++ {
|
||||
for i := r.Start(); i <= r.End() && i >= r.Start(); i++ {
|
||||
if !f(i) {
|
||||
return
|
||||
}
|
||||
if i+1 < i { // integer overflow
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user