github-vet / github-vet/rangeloop-pointer-findings
yeeco/gyee: p2p/dht/route.go; 28 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [yeeco/gyee](https://www.github.com/yeeco/gyee) at [p2p/dht/route.go](https://github.com/yeeco/gyee/blob/05aca43e839014daa2d772ced8cdfa9a1f4b196d/p2p/dht/route.go#L682-L709)
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/yeeco/gyee/blob/05aca43e839014daa2d772ced8cdfa9a1f4b196d/p2p/dht/route.go#L682-L709)
Click here to show the 28 line(s) of Go which triggered the analyzer.
```go
for idx, n := range req.Seens {
if bytes.Compare(n.ID[0:], rutMgr.localNodeId[0:]) == 0 {
log.Debugf("updateReq: discard local node seen, sdl: %s", rutMgr.sdlName)
continue
}
if n.IP.IsUnspecified() {
log.Debugf("updateReq: discard unspecified node seen, sdl: %s", rutMgr.sdlName)
continue
}
dur := req.Duras[idx]
rutMgr.rutMgrMetricSample(n.ID, dur)
p := n.ID
h := rutMgrNodeId2Hash(p)
d := rutMgr.rutMgrLog2Dist(&rutMgr.rutTab.shaLocal, h)
if eno, el := rutMgr.find(p, d); eno == DhtEnoNone {
bn := el.Value.(*rutMgrBucketNode)
bn.fails = 0
} else {
rt := &rutMgr.rutTab
pcs := conInstStatus2PCS(CisNull)
doUpdate(&rt.shaLocal, &n, req.Duras[idx], pcs)
rutMgr.showRoute("rutMgrUpdate4Query.DhtEnoNone")
}
}
```
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 {doUpdate 4} 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: 05aca43e839014daa2d772ced8cdfa9a1f4b196d
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with p2p/dht/route.go lines 682-709 and trace the range-loop values through doUpdate and the surrounding call path. Determine whether the analyzer's reported pointer behavior is reachable and whether it changes runtime behavior; done means documenting a supported Bug, Mitigated, or Desirable Behavior classification, with regression coverage if a defect is confirmed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100