Add fuzzers for consumption by https://github.com/google/oss-fuzz
This commit is contained in:
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user