github-vet / github-vet/rangeloop-pointer-findings
coreos/coreos-assembler: tools/vendor/github.com/minio/minio/cmd/storage-rest-server.go; 3 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [coreos/coreos-assembler](https://www.github.com/coreos/coreos-assembler) at [tools/vendor/github.com/minio/minio/cmd/storage-rest-server.go](https://github.com/coreos/coreos-assembler/blob/60e6c83a6ec7e9f67231d3cbbe3987c833eb4758/tools/vendor/github.com/minio/minio/cmd/storage-rest-server.go#L574-L576)
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 which takes a reference to fi at line 575 may start a goroutine
[Click here to see the code in its original context.](https://github.com/coreos/coreos-assembler/blob/60e6c83a6ec7e9f67231d3cbbe3987c833eb4758/tools/vendor/github.com/minio/minio/cmd/storage-rest-server.go#L574-L576)
Click here to show the 3 line(s) of Go which triggered the analyzer.
```go
for fi := range fch {
logger.LogIf(r.Context(), encoder.Encode(&fi))
}
```
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 calling a goroutine:
digraph G {
"(copyFileWithTar, 4)" -> {}
"(RemoveAllRelative, 2)" -> {"(Open, 1)";}
"(delete, 3)" -> {"(Execute, 3)";}
"(copyWithTar, 4)" -> {"(tarPath, 1)";}
"(TarWithOptions, 2)" -> {}
"(runCmdContext, 2)" -> {}
"(parse, 1)" -> {"(append, 1)";}
"(NewReader, 2)" -> {}
"(NewRequest, 3)" -> {"(Parse, 1)";}
"(configureTransport, 1)" -> {"(addConnIfNeeded, 3)";}
"(run, 3)" -> {"(runCmdContext, 2)";}
"(NewClientConn, 3)" -> {"(clientHandshake, 2)";}
"(Add, 4)" -> {"(copyWithTar, 4)";"(copyFileWithTar, 4)";"(NewImageSource, 2)";}
"(Create, 1)" -> {"(Open, 1)";}
"(Append, 1)" -> {"(Execute, 3)";}
"(decode, 1)" -> {"(Parse, 2)";}
"(Expand, 2)" -> {"(parse, 1)";}
"(SetTransportDefaults, 1)" -> {"(ConfigureTransport, 1)";}
"(CheckProgram, 1)" -> {}
"(newClientTransport, 6)" -> {}
"(New, 1)" -> {"(get, 1)";"(Parse, 1)";"(NewClient, 2)";"(newClient, 1)";}
"(ConfigureTransport, 1)" -> {"(configureTransport, 1)";}
"(Replace, 4)" -> {"(Fix, 4)";}
"(saveIssuesToCache, 5)" -> {}
"(dialWithoutProxy, 2)" -> {"(Dial, 3)";}
"(RunUsingChroot, 6)" -> {}
"(newSyncProducerFromAsyncProducer, 1)" -> {}
"(NewClient, 2)" -> {}
"(Put, 1)" -> {"(Do, 1)";"(Put, 3)";"(Copy, 2)";"(Delete, 2)";}
"(Parse, 1)" -> {"(parse, 1)";"(Replace, 4)";}
"(Put, 3)" -> {"(Create, 1)";}
"(NewImageSource, 2)" -> {"(Diff, 3)";}
"(computeEditsFromProg, 1)" -> {}
"(Delete, 2)" -> {"(Validate, 1)";}
"(Sum, 1)" -> {"(Read, 1)";}
"(dial, 1)" -> {"(dialWithoutProxy, 2)";}
"(Write, 1)" -> {"(New, 1)";"(Format, 1)";"(NewRequest, 3)";"(Update, 3)";"(Put, 1)";"(Sum, 1)";"(Do, 1)";"(Parse, 1)";"(write, 3)";"(Copy, 2)";"(Remove, 1)";"(Set, 2)";"(Decode, 1)";}
"(EncodeMsg, 1)" -> {"(Append, 1)";}
"(Run, 2)" -> {"(runAnalyzers, 2)";"(runUsingRuntimeSubproc, 9)";"(RunUsingChroot, 6)";}
"(Diff, 5)" -> {"(ChangesDirs, 4)";}
"(Dial, 1)" -> {"(dial, 1)";}
"(append, 1)" -> {}
"(Parse, 2)" -> {"(parseStreaming, 2)";}
"(Decode, 1)" -> {"(decode, 1)";"(dec, 5)";}
"(Read, 1)" -> {"(newEventFromJournalEntry, 1)";}
"(parseStreaming, 2)" -> {"(Send, 1)";}
"(dec, 5)" -> {"(Parse, 2)";}
"(Dial, 3)" -> {"(NewClientConn, 3)";}
"(clientHandshake, 2)" -> {"(newClientTransport, 6)";}
"(loadIssuesFromCache, 3)" -> {}
"(collectFileInfoForChanges, 4)" -> {}
"(Upload, 1)" -> {"(GetDataWithRanges, 2)";"(Run, 1)";}
"(Run, 1)" -> {"(computeEditsFromProg, 1)";"(processPkg, 2)";"(Run, 2)";}
"(Execute, 3)" -> {}
"(tarPath, 1)" -> {"(TarWithOptions, 2)";}
"(Set, 2)" -> {"(Replace, 4)";}
"(Run, 3)" -> {"(Run, 2)";"(RunWithConfig, 2)";}
"(Do, 1)" -> {"(Decode, 1)";"(Upload, 1)";"(Expand, 2)";"(Decode, 2)";"(Delete, 2)";}
"(get, 1)" -> {"(Open, 1)";"(SetTransportDefaults, 1)";}
"(processPkg, 2)" -> {}
"(Update, 3)" -> {"(Validate, 1)";}
"(Fix, 4)" -> {"(Run, 3)";}
"(Open, 1)" -> {"(NewReader, 2)";}
"(write, 3)" -> {"(Create, 1)";}
"(Remove, 1)" -> {"(RemoveAllRelative, 2)";"(delete, 3)";}
"(newEventFromJournalEntry, 1)" -> {"(Parse, 2)";}
"(runAnalyzers, 2)" -> {"(loadIssuesFromCache, 3)";"(saveIssuesToCache, 5)";}
"(Copy, 2)" -> {"(Add, 4)";}
"(Format, 1)" -> {"(Do, 1)";"(Parse, 1)";}
"(GetDataWithRanges, 2)" -> {}
"(Encode, 2)" -> {"(EncodeMsg, 1)";}
"(Decode, 2)" -> {"(parse, 1)";"(decode, 1)";}
"(runUsingRuntimeSubproc, 9)" -> {}
"(newClient, 1)" -> {"(NewMaintenance, 1)";}
"(Diff, 3)" -> {"(Diff, 5)";}
"(Validate, 1)" -> {"(Parse, 2)";"(Append, 1)";}
"(RunWithConfig, 2)" -> {"(CheckProgram, 1)";}
"(NewSyncProducer, 2)" -> {"(newSyncProducerFromAsyncProducer, 1)";}
"(NewMaintenance, 1)" -> {"(Dial, 1)";}
"(Encode, 1)" -> {"(Write, 1)";"(Put, 1)";"(Copy, 2)";"(Encode, 2)";"(Set, 2)";"(New, 1)";}
"(addConnIfNeeded, 3)" -> {"(run, 3)";}
"(ChangesDirs, 4)" -> {"(collectFileInfoForChanges, 4)";}
"(Send, 1)" -> {"(NewSyncProducer, 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: 60e6c83a6ec7e9f67231d3cbbe3987c833eb4758
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at tools/vendor/github.com/minio/minio/cmd/storage-rest-server.go lines 574-576 and inspect the surrounding storage REST server code. Review the analyzer's call graph to determine whether passing &fi to encoder.Encode can lead to a goroutine using the range variable. Done means classifying the finding as a bug, mitigated, or desirable behavior and documenting the evidence.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100