File tree 3 files changed +10
-1
lines changed
cgo/internal/testsanitizers 3 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -135,6 +135,9 @@ func TestASANFuzz(t *testing.T) {
135
135
if bytes .Contains (out , []byte ("AddressSanitizer" )) {
136
136
t .Error (`output contains "AddressSanitizer", but should not` )
137
137
}
138
+ if ! bytes .Contains (out , []byte ("FUZZ FAILED" )) {
139
+ t .Error (`fuzz test did not fail with a "FUZZ FAILED" sentinel error` )
140
+ }
138
141
}
139
142
140
143
func mustHaveASAN (t * testing.T ) * config {
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ func FuzzReverse(f *testing.F) {
24
24
r1 := Reverse (s )
25
25
r2 := Reverse (r1 )
26
26
if s != r2 {
27
- t .Errorf ("got %q want %q" , r2 , s )
27
+ t .Errorf ("FUZZ FAILED: got %q want %q" , r2 , s )
28
28
}
29
29
})
30
30
}
Original file line number Diff line number Diff line change @@ -227,6 +227,12 @@ func canInstrumentGlobal(g ir.Node) bool {
227
227
return false
228
228
}
229
229
230
+ // Do not instrument counter globals in internal/fuzz. These globals are replaced by the linker.
231
+ // See go.dev/issue/72766 for more details.
232
+ if n .Sym ().Pkg .Path == "internal/fuzz" && (n .Sym ().Name == "_counters" || n .Sym ().Name == "_ecounters" ) {
233
+ return false
234
+ }
235
+
230
236
// Do not instrument globals that are linknamed, because their home package will do the work.
231
237
if n .Sym ().Linkname != "" {
232
238
return false
You can’t perform that action at this time.
0 commit comments