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

LessThanThreeLabs/koality: code/back/src/koality/build/snapshotrunner/snapshotRunner.go; 33 LoC

Open
#11,073 0 comments 0 reactions 0 assignees View on GitHub
fresh small
Dominant language
No language data
Stars
0
Forks
0
PR merge metrics
PR metrics pending

Description

Found a possible issue in [LessThanThreeLabs/koality](https://www.github.com/LessThanThreeLabs/koality) at [code/back/src/koality/build/snapshotrunner/snapshotRunner.go](https://github.com/LessThanThreeLabs/koality/blob/8664ac51186b925d3bb21a3fb85a14c32eb268f0/code/back/src/koality/build/snapshotrunner/snapshotRunner.go#L73-L105)

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 98 passes reference to build to third-party code

[Click here to see the code in its original context.](https://github.com/LessThanThreeLabs/koality/blob/8664ac51186b925d3bb21a3fb85a14c32eb268f0/code/back/src/koality/build/snapshotrunner/snapshotRunner.go#L73-L105)

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

```go
for _, build := range builds {
buildData, err := snapshotter.buildRunner.GetBuildData(&build)

if err != nil {
snapshotter.failSnapshot(snapshot)
return false, err
}

for i, section := range buildData.BuildConfig.Sections {
if section.Name() == buildData.BuildConfig.Params.SnapshotUntil {
buildData.BuildConfig.Sections = buildData.BuildConfig.Sections[:i]
break
}
}
buildData.BuildConfig.FinalSections = nil
err = snapshotter.buildRunner.CreateStages(&build, &buildData.BuildConfig)
if err != nil {
snapshotter.failSnapshot(snapshot)
return false, err
}

emptyFinishFunc := func(vm vm.VirtualMachine) {}

newStageRunnersChan := make(chan *stagerunner.StageRunner, 1)

snapshotter.buildRunner.RunStages(virtualMachine, buildData, &build, newStageRunnersChan, emptyFinishFunc)

success, err := snapshotter.buildRunner.ProcessResults(&build, newStageRunnersChan, buildData)
if !success {
snapshotter.failSnapshot(snapshot)
break
}
}

```

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.

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 {
"(RunStages, 5)" -> {}
}

```

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: 8664ac51186b925d3bb21a3fb85a14c32eb268f0

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.