kalexmills / rangeloop-test-repo

Test repository
0 stars 0 forks source link

DigDeeply/gohs-ladon: vendor/golang.org/x/crypto/ssh/kex_test.go; 28 LoC #306

Open kalexmills opened 3 years ago

kalexmills commented 3 years ago

Found a possible issue in DigDeeply/gohs-ladon at vendor/golang.org/x/crypto/ssh/kex_test.go

The below snippet of Go code triggered static analysis which searches for goroutines and/or defer statements which capture loop variables.

Click here to show 28 line(s) of Go. ```go for name, kex := range kexAlgoMap { a, b := memPipe() s := make(chan kexResultErr, 1) c := make(chan kexResultErr, 1) var magics handshakeMagics go func() { r, e := kex.Client(a, rand.Reader, &magics) a.Close() c <- kexResultErr{r, e} }() go func() { r, e := kex.Server(b, rand.Reader, &magics, testSigners["ecdsa"]) b.Close() s <- kexResultErr{r, e} }() clientRes := <-c serverRes := <-s if clientRes.err != nil { t.Errorf("client: %v", clientRes.err) } if serverRes.err != nil { t.Errorf("server: %v", serverRes.err) } if !reflect.DeepEqual(clientRes.result, serverRes.result) { t.Errorf("kex %q: mismatch %#v, %#v", name, clientRes.result, serverRes.result) } } ```

commit ID: 960a70cfc8bf4db30e4ab45715fabf844c1891da

kalexmills commented 3 years ago

!boring