From 6ce1a29d5ab0f47a17bf488135867a3620ce1b27 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Fri, 3 Jan 2020 15:33:13 +0100 Subject: [PATCH] Update fuzzer code to use TESSERACT_FUZZER_WIDTH, TESSERACT_FUZZER_HEIGHT Signed-off-by: Stefan Weil --- unittest/fuzzers/fuzzer-api.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/unittest/fuzzers/fuzzer-api.cpp b/unittest/fuzzers/fuzzer-api.cpp index 64a623b7..86ff5214 100644 --- a/unittest/fuzzers/fuzzer-api.cpp +++ b/unittest/fuzzers/fuzzer-api.cpp @@ -6,6 +6,14 @@ #include // for std::getenv, std::setenv #include // for std::string +#ifndef TESSERACT_FUZZER_WIDTH +#define TESSERACT_FUZZER_WIDTH 100 +#endif + +#ifndef TESSERACT_FUZZER_HEIGHT +#define TESSERACT_FUZZER_HEIGHT 100 +#endif + class BitReader { private: uint8_t const* data; @@ -80,7 +88,7 @@ static PIX* createPix(BitReader& BR, const size_t width, const size_t height) { extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { BitReader BR(data, size); - auto pix = createPix(BR, 100, 100); + auto pix = createPix(BR, TESSERACT_FUZZER_WIDTH, TESSERACT_FUZZER_HEIGHT); api->SetImage(pix);