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

wanchain/schnorr-mpc: storeman/storemanmpc/step/mpc_skpoly_generator.go; 4 LoC

Open
#13,086 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 [wanchain/schnorr-mpc](https://www.github.com/wanchain/schnorr-mpc) at [storeman/storemanmpc/step/mpc_skpoly_generator.go](https://github.com/wanchain/schnorr-mpc/blob/9c36ce91d23b51372de1eaac1dbd18ec990ab848/storeman/storemanmpc/step/mpc_skpoly_generator.go#L53-L56)

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 which takes a reference to value at line 54 may start a goroutine

[Click here to see the code in its original context.](https://github.com/wanchain/schnorr-mpc/blob/9c36ce91d23b51372de1eaac1dbd18ec990ab848/storeman/storemanmpc/step/mpc_skpoly_generator.go#L53-L56)

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

```go
for _, value := range poly.message {
poly.result.Add(poly.result, &value)
poly.result.Mod(poly.result, crypto.S256().Params().N)
}

```

Click here to show extra information the analyzer produced.

```
The following graphviz dot graph describes paths through the callgraph that could lead to a function calling a goroutine:
digraph G {
"(doProtoHandshake, 1)" -> {}
"(NewNodeWithConfig, 1)" -> {"(Send, 1)";}
"(dbDeleteFilterIdxEntry, 3)" -> {"(Delete, 1)";}
"(Add, 2)" -> {"(Set, 1)";"(Mul, 2)";"(Add, 3)";"(Mul, 3)";}
"(Mul, 2)" -> {"(Set, 1)";}
"(IngestBlock, 3)" -> {}
"(UnwindBlock, 2)" -> {}
"(SetupConn, 3)" -> {"(setupConn, 3)";}
"(dbRemoveBlockIDIndexEntry, 2)" -> {"(Delete, 1)";}
"(Start, 0)" -> {"(ListenUDP, 5)";"(jsonRPCRead, 3)";}
"(setupConn, 3)" -> {"(doProtoHandshake, 1)";}
"(jsonRPCRead, 3)" -> {}
"(Add, 3)" -> {"(Double, 2)";"(Put, 1)";}
"(Set, 1)" -> {"(New, 1)";}
"(Write, 1)" -> {"(completeRequest, 3)";}
"(Do, 1)" -> {"(dial, 2)";}
"(dial, 2)" -> {"(Dial, 1)";"(SetupConn, 3)";}
"(delete, 5)" -> {}
"(Delete, 2)" -> {"(delete, 1)";}
"(ListenUDP, 5)" -> {"(newNetwork, 4)";}
"(dbIndexDisconnectBlock, 4)" -> {"(DisconnectBlock, 3)";}
"(Mul, 3)" -> {"(Put, 1)";}
"(New, 1)" -> {"(Add, 1)";"(New, 3)";"(Subscribe, 1)";"(Init, 2)";"(New, 2)";}
"(New, 2)" -> {"(Add, 1)";}
"(Add, 1)" -> {"(add, 1)";}
"(executeControlEvent, 1)" -> {"(executeNodeEvent, 1)";}
"(Double, 2)" -> {"(Put, 1)";}
"(add, 1)" -> {}
"(completeRequest, 3)" -> {}
"(Send, 1)" -> {"(delete, 1)";}
"(Subscribe, 1)" -> {"(Do, 1)";"(executeControlEvent, 1)";}
"(Dial, 1)" -> {"(SetupConn, 3)";}
"(delete, 1)" -> {"(delete, 5)";}
"(newNetwork, 4)" -> {}
"(DisconnectBlock, 3)" -> {"(dbRemoveBlockIDIndexEntry, 2)";"(dbDeleteFilterIdxEntry, 3)";}
"(New, 3)" -> {"(IngestBlock, 3)";"(UnwindBlock, 2)";}
"(Start, 1)" -> {"(Start, 0)";"(DialInProc, 1)";"(StartHttpServer, 2)";}
"(DialInProc, 1)" -> {}
"(Init, 2)" -> {"(dbIndexDisconnectBlock, 4)";}
"(Delete, 1)" -> {"(Delete, 2)";}
"(Put, 1)" -> {"(Write, 1)";"(Add, 1)";"(tryAccessIdx, 2)";}
"(tryAccessIdx, 2)" -> {"(Write, 1)";}
"(executeNodeEvent, 1)" -> {"(Start, 1)";"(NewNodeWithConfig, 1)";}
"(StartHttpServer, 2)" -> {}
}

```

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: 9c36ce91d23b51372de1eaac1dbd18ec990ab848

Contributor guide

No contributing guide indexed for this repository

Research direction

Read storeman/storemanmpc/step/mpc_skpoly_generator.go at lines 53-56 and inspect the range loop, the reference passed to Add, and the analyzer's call graph. Determine whether the reported finding is a Bug, Mitigated, or Desirable Behavior, then leave the corresponding reaction on the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.