github-vet / github-vet/rangeloop-pointer-findings
opencontainers/image-tools: image/image.go; 44 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [opencontainers/image-tools](https://www.github.com/opencontainers/image-tools) at [image/image.go](https://github.com/opencontainers/image-tools/blob/22b993e8aa1c17e1cbe5d251b7b4f937a665966a/image/image.go#L95-L138)
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.
> reference to desc is reassigned at line 96
[Click here to see the code in its original context.](https://github.com/opencontainers/image-tools/blob/22b993e8aa1c17e1cbe5d251b7b4f937a665966a/image/image.go#L95-L138)
Click here to show the 44 line(s) of Go which triggered the analyzer.
```go
for _, desc := range descs {
d := &desc
if err = validateDescriptor(d, w, validRefMediaTypes); err != nil {
return err
}
if d.MediaType == validRefMediaTypes[0] {
m, err := findManifest(w, d)
if err != nil {
return err
}
if err := validateManifest(m, w); err != nil {
return err
}
}
if d.MediaType == validRefMediaTypes[1] {
index, err := findIndex(w, d)
if err != nil {
return err
}
if err := validateIndex(index, w); err != nil {
return err
}
if len(index.Manifests) == 0 {
fmt.Println("warning: no manifests found")
return nil
}
for _, manifest := range index.Manifests {
m, err := findManifest(w, &manifest)
if err != nil {
return err
}
if err := validateManifest(m, w); err != nil {
return err
}
}
}
}
```
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: 22b993e8aa1c17e1cbe5d251b7b4f937a665966a
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.