github-vet / github-vet/rangeloop-pointer-findings

sydneyli/keynet: src/pbft/view_change.go; 5 LoC

Open
#13,504 0 comments 0 reactions 0 assignees View on GitHub
fresh tiny
Dominant language
No language data
Stars
0
Forks
0
PR merge metrics
PR metrics pending

Description

Found a possible issue in [sydneyli/keynet](https://www.github.com/sydneyli/keynet) at [src/pbft/view_change.go](https://github.com/sydneyli/keynet/blob/2c144b2741d2f149511e340f6ca002fb3b5eb606/src/pbft/view_change.go#L113-L117)

Below is the message reported by the analyzer for this snippet of code. Beware that the analyzer only reports the first issue it finds, so please do not limit your consideration to the contents of the below message.

> function call which takes a reference to preprepare at line 115 may start a goroutine

[Click here to see the code in its original context.](https://github.com/sydneyli/keynet/blob/2c144b2741d2f149511e340f6ca002fb3b5eb606/src/pbft/view_change.go#L113-L117)

Click here to show the 5 line(s) of Go which triggered the analyzer.

```go
for _, preprepare := range newViewMessage.PrePrepares {
if preprepare.SignedMessage.PrePrepareMessage.Number.SeqNumber > n.sequenceNumber {
n.handlePrePrepare(&preprepare)
}
}

```

Click here to show extra information the analyzer produced.

```
The following graphviz dot graph describes paths through the callgraph that could lead to a function calling a goroutine:
digraph G {
"(handlePrePrepare, 1)" -> {}
}

```

Leave a reaction on this issue to contribute to the project by classifying this instance as a **Bug** :-1:, **Mitigated** :+1:, or **Desirable Behavior** :rocket:
See the descriptions of the classifications [here](https://github.com/github-vet/rangeclosure-findings#how-can-i-help) for more information.

commit ID: 2c144b2741d2f149511e340f6ca002fb3b5eb606

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at src/pbft/view_change.go lines 113-117 and inspect the handlePrePrepare call in the referenced commit, then determine whether the referenced range variable can be used after the loop iteration. Confirm the analyzer's classification as Bug, Mitigated, or Desirable Behavior and leave the corresponding reaction.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
distributed-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.