github-vet / github-vet/rangeloop-pointer-findings
njm256/vezir: engine/mcts.go; 11 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [njm256/vezir](https://www.github.com/njm256/vezir) at [engine/mcts.go](https://github.com/njm256/vezir/blob/ebace5d1aa49a87c3e3ae730975f898633bff1e2/engine/mcts.go#L80-L90)
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.
> reference to v is reassigned at line 88
[Click here to see the code in its original context.](https://github.com/njm256/vezir/blob/ebace5d1aa49a87c3e3ae730975f898633bff1e2/engine/mcts.go#L80-L90)
Click here to show the 11 line(s) of Go which triggered the analyzer.
```go
for _, v := range tree.root.children {
if best.sims == 0 {
break
}
if v.sims == 0 {
continue
}
if float64(v.score)/float64(v.sims) > float64(best.score)/float64(best.sims) {
best = &v
}
}
```
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: ebace5d1aa49a87c3e3ae730975f898633bff1e2
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with engine/mcts.go lines 80-90 and the linked original context. Determine whether assigning &v in the range loop changes which child best refers to, then classify the finding as Bug, Mitigated, or Desirable Behavior using the repository's linked guidance; done means a supported classification.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100