github-vet / github-vet/rangeloop-pointer-findings
zhaojq-github/PSI: init/initDb.go; 4 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [zhaojq-github/PSI](https://www.github.com/zhaojq-github/PSI) at [init/initDb.go](https://github.com/zhaojq-github/PSI/blob/232ad502078b10008729bd33390ce745959420dc/init/initDb.go#L59-L62)
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 at line 61 passes reference to k to third-party code
[Click here to see the code in its original context.](https://github.com/zhaojq-github/PSI/blob/232ad502078b10008729bd33390ce745959420dc/init/initDb.go#L59-L62)
Click here to show the 4 line(s) of Go which triggered the analyzer.
```go
for _, k := range initUsers.Users {
//admin系统管理员
md.AddUser(&k, &user)
}
```
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 which writes a pointer argument:
digraph G {
"(AddUser, 2)" -> {}
}
The following graphviz dot graph describes paths through the callgraph that could lead to a function which passes a pointer to third-party code:
digraph G {
"(AddUser, 2)" -> {}
}
```
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: 232ad502078b10008729bd33390ce745959420dc
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with init/initDb.go lines 59-62 and inspect the AddUser call and its handling of the loop variable pointer. Determine whether the analyzer finding is a bug, mitigated, or desirable behavior, then leave the corresponding reaction as described in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100