WARNING: DATA RACE
Write at 0x000000c3c628 by goroutine 38:
github.com/go-ldap/ldap.FuzzParseDN()
/home/runner/work/ldap/ldap/fuzz_test.go:14 +0x32
testing.fRunner()
/opt/hostedtoolcache/go/1.18.10/x64/src/testing/fuzz.go:700 +0x168
testing.runFuzzTests.func1()
/opt/hostedtoolcache/go/1.18.10/x64/src/testing/fuzz.go:5[20](https://github.com/go-ldap/ldap/actions/runs/6781841980/job/18432888679#step:5:21) +0x47
Fuzz tests also run as unit tests, so the module global variable shouldn't change in a test function.
ber.MaxPacketLengthBytes = 65536
I fix this conflict by adding TestMain(), which handles a setup process before all tests. Now, all tests run with ber.MaxPacketLengthBytes limitation. Does it make sense?
I investigated why DATA RACE occurred.
Fuzz tests also run as unit tests, so the module global variable shouldn't change in a test function.
I fix this conflict by adding TestMain(), which handles a setup process before all tests. Now, all tests run with
ber.MaxPacketLengthBytes
limitation. Does it make sense?See also #472.
References