github-vet / github-vet/rangeloop-pointer-findings
oragono/oragono: irc/client.go; 38 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [oragono/oragono](https://www.github.com/oragono/oragono) at [irc/client.go](https://github.com/oragono/oragono/blob/0db4b42ffe178a8267fd82f3e6ffbe86ccdf2139/irc/client.go#L1079-L1116)
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/oragono/oragono/blob/0db4b42ffe178a8267fd82f3e6ffbe86ccdf2139/irc/client.go#L1079-L1116)
Click here to show the 38 line(s) of Go which triggered the analyzer.
```go
for _, item := range items {
var command string
switch item.Type {
case history.Invite:
if isSelfMessage(&item) {
continue
}
if hasEventPlayback {
rb.AddFromClient(item.Message.Time, item.Message.Msgid, item.Nick, item.AccountName, nil, "INVITE", nick, item.Message.Message)
} else {
rb.AddFromClient(item.Message.Time, utils.MungeSecretToken(item.Message.Msgid), histservService.prefix, "*", nil, "PRIVMSG", fmt.Sprintf(client.t("%[1]s invited you to channel %[2]s"), NUHToNick(item.Nick), item.Message.Message))
}
continue
case history.Privmsg:
command = "PRIVMSG"
case history.Notice:
command = "NOTICE"
case history.Tagmsg:
if hasEventPlayback && hasTags {
command = "TAGMSG"
} else {
continue
}
default:
continue
}
var tags map[string]string
if hasTags {
tags = item.Tags
}
if !isSelfMessage(&item) {
rb.AddSplitMessageFromClient(item.Nick, item.AccountName, tags, command, nick, item.Message)
} else {
// this message was sent *from* the client to another nick; the target is item.Params[0]
// substitute client's current nickmask in case client changed nick
rb.AddSplitMessageFromClient(details.nickMask, item.AccountName, tags, command, item.Params[0], item.Message)
}
}
```
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 {isSelfMessage 1} 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: 0db4b42ffe178a8267fd82f3e6ffbe86ccdf2139
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with irc/client.go lines 1079-1116, then inspect isSelfMessage and the AddFromClient/AddSplitMessageFromClient calls shown in the snippet. Determine whether the range-loop item reference can escape or cause incorrect behavior, and classify the finding as Bug, Mitigated, or Desirable Behavior using the linked project guidance.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100