#include <allheaders.h>
#include <tesseract/baseapi.h>
#include <libgen.h>
#include <cstdio>
#include <cstdlib>
#include <string>
Go to the source code of this file.
◆ TESSERACT_FUZZER_HEIGHT
#define TESSERACT_FUZZER_HEIGHT 100 |
◆ TESSERACT_FUZZER_WIDTH
#define TESSERACT_FUZZER_WIDTH 100 |
◆ LLVMFuzzerInitialize()
int LLVMFuzzerInitialize |
( |
int * |
, |
|
|
char *** |
pArgv |
|
) |
| |
Definition at line 46 of file fuzzer-api.cpp.
47 if (std::getenv(
"TESSDATA_PREFIX") ==
nullptr) {
48 std::string binary_path = *pArgv[0];
49 const std::string filepath = dirname(&binary_path[0]);
51 const std::string tessdata_path = filepath +
"/" +
"tessdata";
52 if (setenv(
"TESSDATA_PREFIX", tessdata_path.c_str(), 1) != 0) {
53 printf(
"Setenv failed\n");
59 if (api->
Init(
nullptr,
"eng") != 0) {
60 printf(
"Cannot initialize API\n");
struct TessBaseAPI TessBaseAPI
bool SetVariable(const char *name, const char *value)
int Init(const char *datapath, const char *language, OcrEngineMode mode, char **configs, int configs_size, const std::vector< std::string > *vars_vec, const std::vector< std::string > *vars_values, bool set_only_non_debug_params)
◆ LLVMFuzzerTestOneInput()
int LLVMFuzzerTestOneInput |
( |
const uint8_t * |
data, |
|
|
size_t |
size |
|
) |
| |
Definition at line 87 of file fuzzer-api.cpp.
#define TESSERACT_FUZZER_WIDTH
#define TESSERACT_FUZZER_HEIGHT
void SetImage(const unsigned char *imagedata, int width, int height, int bytes_per_pixel, int bytes_per_line)