github-vet / github-vet/rangeloop-pointer-findings
juchain/go-juchain: core/genesis.go; 12 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [juchain/go-juchain](https://www.github.com/juchain/go-juchain) at [core/genesis.go](https://github.com/juchain/go-juchain/blob/457eeb33a882a6481517f00edc1db8ca340cd014/core/genesis.go#L299-L310)
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 addr is reassigned at line 301
[Click here to see the code in its original context.](https://github.com/juchain/go-juchain/blob/457eeb33a882a6481517f00edc1db8ca340cd014/core/genesis.go#L299-L310)
Click here to show the 12 line(s) of Go which triggered the analyzer.
```go
for addr, account := range g.Alloc {
if dappAddr == nil {
dappAddr = &addr; // set the first address as the creator of dapp contract.
}
// if the balance of selected dapp account is zero, will meet gas underpriced exception.
statedb.AddBalance(addr, account.Balance)
statedb.SetCode(addr, account.Code)
statedb.SetNonce(addr, account.Nonce)
for key, value := range account.Storage {
statedb.SetState(addr, key, value)
}
}
```
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: 457eeb33a882a6481517f00edc1db8ca340cd014
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.