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

finogeeks/Ligase: model/repos/roomStateTimelineRepo.go; 7 LoC

Open
#14,887 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 [finogeeks/Ligase](https://www.github.com/finogeeks/Ligase) at [model/repos/roomStateTimelineRepo.go](https://github.com/finogeeks/Ligase/blob/97bf8f331c3422310d941109facdaeac6ea2b15c/model/repos/roomStateTimelineRepo.go#L369-L375)

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 ev is reassigned at line 371

[Click here to see the code in its original context.](https://github.com/finogeeks/Ligase/blob/97bf8f331c3422310d941109facdaeac6ea2b15c/model/repos/roomStateTimelineRepo.go#L369-L375)

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

```go
for i, ev := range evs {
streamEv := new(feedstypes.StreamEvent)
streamEv.Ev = &ev
streamEv.Offset = offsets[i]
streamEvs = append(streamEvs, streamEv)
events = append(events, streamEv.GetEv())
}

```

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: 97bf8f331c3422310d941109facdaeac6ea2b15c

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with model/repos/roomStateTimelineRepo.go at lines 369-375 and inspect the analyzer's report that ev is reassigned at line 371. Determine whether the range-loop reference is unsafe, then verify the intended behavior in the surrounding repository code; done means the finding is classified as Bug, Mitigated, or Desirable Behavior with supporting evidence.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend
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.