github.com/google/syzkaller@v0.0.0-20251211124644-a066d2bc4b02/pkg/kfuzztest/testdata/2/prog.c (about) 1 // Copyright 2025 syzkaller project authors. All rights reserved. 2 // Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. 3 #include "../common.h" 4 5 #include <stdlib.h> 6 7 struct bar { 8 int a; 9 int b; 10 }; 11 12 struct foo { 13 struct bar* b; 14 const char* str; 15 const char* data; 16 size_t datalen; 17 uint64_t* numbers; 18 }; 19 20 DEFINE_FUZZ_TARGET(some_target, struct foo); 21 /* Expect foo.bar != NULL. */ 22 DEFINE_CONSTRAINT(foo, bar, NULL, NULL, EXPECT_NE); 23 /* Expect foo.str != NULL. */ 24 DEFINE_CONSTRAINT(foo, str, NULL, NULL, EXPECT_NE); 25 /* Annotate foo.str as a string. */ 26 DEFINE_ANNOTATION(foo, str, , ATTRIBUTE_STRING); 27 /* Expect foo.data != NULL. */ 28 DEFINE_CONSTRAINT(foo, data, NULL, NULL, EXPECT_NE); 29 /* Annotate foo.data as an array. */ 30 DEFINE_ANNOTATION(foo, data, , ATTRIBUTE_ARRAY); 31 /* Annotate foo.datalen == len(foo.data). */ 32 DEFINE_ANNOTATION(foo, datalen, data, ATTRIBUTE_LEN); 33 /* Annotate foo.numbers as an array. */ 34 DEFINE_ANNOTATION(foo, numbers, , ATTRIBUTE_ARRAY); 35 36 /* Define a main function, otherwise the compiler complains. */ 37 int main(void) 38 { 39 }