Closed t2y closed 6 months ago
Rarely, but I could reproduce it in my local environment. It's a concurrent race condition issue, I guess.
The job is here.
- name: Build and Validate
run: |
cd ${{ matrix.branch }}
go vet .
go test .
go test -cover -race -cpu 1,2,4 .
go build .
I confirmed this CLI would fail.
$ go test -cover -race -cpu 1,2,4 .
==================
WARNING: DATA RACE
Write at 0x000000d016a0 by goroutine 1003:
github.com/go-ldap/ldap.FuzzParseDN()
...
I understood this configuration is module global variable and multiple goroutines access to the variable. In FuzzParseDN(), the variable changed, so it occurred DATA RACE.
ber.MaxPacketLengthBytes = 65536
Fuzz test has two modes. So FuzzParseDN()
is always called with seed corpus.
There are two modes of running your fuzz test: as a unit test (default go test), or with fuzzing (go test -fuzz=FuzzTestName).
Fuzz tests are run much like a unit test by default. Each seed corpus entry will be tested against the fuzz target, reporting any failures before exiting.
There are different requirements for each test.
Setting a value before all tests by TestMain resolves it. ber.MaxPacketLengthBytes
limit is not affected for other tests.
func TestMain(m *testing.M) {
// For fuzz tests
// See https://github.com/go-asn1-ber/asn1-ber/blob/04301b4b1c5ff66221f8f8a394f814a9917d678a/fuzz_test.go#L33-L37
// for why this limitation is necessary
ber.MaxPacketLengthBytes = 65536
code := m.Run()
os.Exit(code)
}
I don't know why v3 directory doesn't have fuzz_test.go
.
I don't know why v3 directory doesn't have
fuzz_test.go
.
Yes, we should make sure the v3 directory matches the root (until we develop a proper branch strategy)
I encountered some failures with the result of a job on GitHub Actions.
I will investigate why this error happens on GitHub Actions.