Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
283 changes: 15 additions & 268 deletions MODULE.bazel.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 8 additions & 1 deletion scion/ping/ping.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,11 +203,18 @@ func (p *pinger) Ping(
go func() {
defer log.HandlePanic()
defer wg.Done()
for i := uint16(0); i < p.attempts; i++ {

Copy link

Copilot AI Dec 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If p.attempts is 0, the loop will run indefinitely since i will underflow when decremented. Add a check to handle the case where p.attempts is 0, or ensure p.attempts is always greater than 0.

Suggested change
if p.attempts == 0 {
// No packets to send; avoid underflow in the decrementing loop.
return
}

Copilot uses AI. Check for mistakes.
i := p.attempts
Copy link

Copilot AI Dec 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable i should retain the uint16 type annotation for clarity and to match the original type, e.g., i := uint16(p.attempts) or ensure type consistency with the original loop counter.

Copilot uses AI. Check for mistakes.
for {
if err := p.send(remote, dPath, nextHop); err != nil {
errSend <- serrors.Wrap("sending", err)
return
}
i--
if i == 0 {
// Don't wait for the tick after we're done.
break
}
select {
case <-send.C:
case <-ctx.Done():
Expand Down
Loading