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

zond/godip-history: state/state.go; 14 LoC

Aperta
#9,653 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
fresh small
Lingua principale
Nessun dato sulla lingua
Stelle
0
Fork
0
Metriche di merge delle PR
Metriche PR in attesa

Descrizione

Found a possible issue in [zond/godip-history](https://www.github.com/zond/godip-history) at [state/state.go](https://github.com/zond/godip-history/blob/5520b470f9113e9fe191b805f0a0abb45b53e5ec/state/state.go#L119-L132)

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.

>

[Click here to see the code in its original context.](https://github.com/zond/godip-history/blob/5520b470f9113e9fe191b805f0a0abb45b53e5ec/state/state.go#L119-L132)

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

```go
for prov, unit := range self.units {
visitedProvinces[prov] = true
var order common.Order
var ok bool
if order, _, ok = self.Order(prov); !ok {
order = nil
}
unitCopy := unit
if filter(prov, order, &unit) {
provinces = append(provinces, prov)
orders = append(orders, order)
units = append(units, &unitCopy)
}
}

```

Click here to show extra information the analyzer produced.

```
No path was found through the callgraph that could lead to a function which writes a pointer argument.

No path was found through the callgraph that could lead to a function which passes a pointer to third-party code.

root signature {filter 3} was not found in the callgraph; reference was passed directly to third-party code
```

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: 5520b470f9113e9fe191b805f0a0abb45b53e5ec

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

Inizia da state/state.go lines 119-132 e verifica come vengono utilizzati la variabile del range-loop e unitCopy nella chiamata a filter e nei puntatori aggiunti. Confronta questo comportamento con il report dell’analizzatore, quindi classifica il risultato come Bug, Mitigated o Desirable Behavior utilizzando le indicazioni di classificazione collegate e una reazione all’issue.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
go
Ambito
backend
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
25/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.