forked from google/woff2
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request google#71 from google/oss-fuzz
Add fuzzers for consumption by https://github.com/google/oss-fuzz
- Loading branch information
Showing
4 changed files
with
38 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
*.o | ||
*.a | ||
/woff2_compress | ||
/woff2_decompress |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#include <stddef.h> | ||
#include <stdint.h> | ||
|
||
#include "woff2_dec.h" | ||
|
||
// Entry point for LibFuzzer. | ||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { | ||
std::string buf; | ||
woff2::WOFF2StringOut out(&buf); | ||
out.SetMaxSize(30 * 1024 * 1024); | ||
woff2::ConvertWOFF2ToTTF(data, size, &out); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#include <string> | ||
#include "woff2_dec.h" | ||
|
||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t data_size) { | ||
// Decode using newer entry pattern. | ||
// Same pattern as woff2_decompress. | ||
std::string output(std::min(woff2::ComputeWOFF2FinalSize(data, data_size), | ||
woff2::kDefaultMaxSize), 0); | ||
woff2::WOFF2StringOut out(&output); | ||
woff2::ConvertWOFF2ToTTF(data, data_size, &out); | ||
return 0; | ||
} |