1
0
mirror of https://github.com/golang/go synced 2024-11-18 12:24:48 -07:00
go/misc/cgo/testsanitizers/testdata/libfuzzer2.c
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

12 lines
240 B
C

#include <stddef.h>
#include "libfuzzer2.h"
int LLVMFuzzerTestOneInput(char *data, size_t size) {
if (size > 0 && data[0] == 'H')
if (size > 1 && data[1] == 'I')
if (size > 2 && data[2] == '!')
FuzzMe(data, size);
return 0;
}