1
0
mirror of https://github.com/golang/go synced 2024-11-08 11:56:16 -07:00
go/misc/cgo/testsanitizers/testdata/libfuzzer2.go
Cherry Mui e870de9936 misc/cgo/testsanitizers: add libfuzzer tests
Apparently we don't have tests for libfuzzer mode. Add some tests.

Updates #57449.

Change-Id: I813da3e71c6d6f15db31914b248db220b0b7041e
Reviewed-on: https://go-review.googlesource.com/c/go/+/459555
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
2022-12-27 21:10:04 +00:00

17 lines
254 B
Go

package main
import "C"
import "unsafe"
//export FuzzMe
func FuzzMe(p unsafe.Pointer, sz C.int) {
b := C.GoBytes(p, sz)
b = b[3:]
if len(b) >= 4 && b[0] == 'f' && b[1] == 'u' && b[2] == 'z' && b[3] == 'z' {
panic("found it")
}
}
func main() {}