Skip to content

Commit

Permalink
save
Browse files Browse the repository at this point in the history
  • Loading branch information
aidenwang9867 committed Jul 7, 2022
1 parent 1f77a10 commit 863cbb2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions checks/raw/fuzzing.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ var languageFuzzSpecs = map[clients.LanguageName]languageFuzzConfig{
"Go fuzzing intelligently walks through the source code to report failures and find vulnerabilities."),
},
clients.Cpp: {
filePattern: "fuzz_*.cpp",
filePattern: "fuzz_*.c*",
Name: fuzzerBuiltInCpp,
funcPattern: `extern\s+[("C")\s]*[\w\*]+\s+(\w*((?i)fuzz)+\w*)+\s*\([\w* ,]*\)`,
funcPattern: `extern\s+[("C")\s]*[\w\*]+\s+LLVMFuzzerTestOneInput\s*\([\w* ,]*\)`,
URL: asPointer("https://github.com/google/fuzzing/blob/master/docs/good-fuzz-target.md"),
Desc: asPointer(
"C++ Fuzz This Function.",
Expand Down
14 changes: 8 additions & 6 deletions checks/raw/fuzzing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,19 +203,21 @@ func Test_fuzzFileAndFuncMatchPattern(t *testing.T) {
expectedFuncMatch: true,
lang: clients.LanguageName("c++"),
fileName: "fuzz_test1.cpp",
fileContent: `extern "C" int LLVMFuzzerTestOneInputProperty
(const uint8_t * data, size_t size)`,
fileContent: `extern "C" int LLVMFuzzerTestOneInput
(const uint8_t *Data, size_t Size) {
DoSomethingInterestingWithMyAPI(Data, Size);
return 0; // Non-zero return values are reserved for future use.
}`,
wantErr: false,
},
{
name: "cpp fuzz func test2",
expectedFileMatch: true,
expectedFuncMatch: true,
lang: clients.LanguageName("c++"),
fileName: "fuzz_test2_foo.cpp",
fileName: "fuzz_test2_foo.cc",
fileContent: `
extern void realloc_fuzz_test(void);
extern int MemcmpFuzzTest(void);
extern void LLVMFuzzerTestOneInput (const uint8_t *Data, size_t Size)
`,
wantErr: false,
},
Expand All @@ -225,7 +227,7 @@ func Test_fuzzFileAndFuncMatchPattern(t *testing.T) {
expectedFuncMatch: false,
lang: clients.LanguageName("c++"),
fileName: "notAFuzzFile_1.cpp",
fileContent: `extern char* TestProperty1 (void);`,
fileContent: `extern "C" int FuzzerTestSomethingElse`,
wantErr: true,
},
{
Expand Down

0 comments on commit 863cbb2

Please sign in to comment.