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

Apicurio/apicurio-registry-operator: pkg/controller/apicurioregistry/svc/patcher/patcher_ocp.go; 5 LoC

Open
#17,190 0 comments 0 reactions 0 assignees View on GitHub
fresh tiny
Dominant language
No language data
Stars
0
Forks
0
PR merge metrics
PR metrics pending

Description

Found a possible issue in [Apicurio/apicurio-registry-operator](https://www.github.com/Apicurio/apicurio-registry-operator) at [pkg/controller/apicurioregistry/svc/patcher/patcher_ocp.go](https://github.com/Apicurio/apicurio-registry-operator/blob/91d6ede91c49e1109e1d7947d9b30320bdfb37cb/pkg/controller/apicurioregistry/svc/patcher/patcher_ocp.go#L88-L92)

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/Apicurio/apicurio-registry-operator/blob/91d6ede91c49e1109e1d7947d9b30320bdfb37cb/pkg/controller/apicurioregistry/svc/patcher/patcher_ocp.go#L88-L92)

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

```go
for _, r := range rs.Items {
if r.GetObjectMeta().GetDeletionTimestamp() == nil && r.Spec.Host == existingHost {
this.ctx.GetResourceCache().Set(resources.RC_KEY_ROUTE_OCP, resources.NewResourceCacheEntry(common.Name(r.Name), &r))
}
}

```

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 {NewResourceCacheEntry 2} 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: 91d6ede91c49e1109e1d7947d9b30320bdfb37cb

Contributor guide

No contributing guide indexed for this repository

Research direction

Read pkg/controller/apicurioregistry/svc/patcher/patcher_ocp.go around lines 88-92, then trace NewResourceCacheEntry and the resource-cache entry it receives. Determine whether the range variable reference can escape or be retained incorrectly, and confirm the analyzer finding or document why it is safe; done means the pointer behavior is verified and any needed fix is covered by relevant tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
infrastructure
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.