summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'leptonica/prog/fuzzing/ccbord_fuzzer.cc')
-rw-r--r--leptonica/prog/fuzzing/ccbord_fuzzer.cc27
1 files changed, 27 insertions, 0 deletions
diff --git a/leptonica/prog/fuzzing/ccbord_fuzzer.cc b/leptonica/prog/fuzzing/ccbord_fuzzer.cc
new file mode 100644
index 00000000..f1b0e19a
--- /dev/null
+++ b/leptonica/prog/fuzzing/ccbord_fuzzer.cc
@@ -0,0 +1,27 @@
+#include "leptfuzz.h"
+
+extern "C" int
+LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
+{
+
+ if(size<3) return 0;
+
+ leptSetStdNullHandler();
+
+ PIX *pixs, *pixc;
+ CCBORDA *ccba;
+
+ pixs = pixReadMemSpix(data, size);
+ if(pixs==NULL) return 0;
+
+ ccba = pixGetAllCCBorders(pixs);
+
+ ccbaStepChainsToPixCoords(ccba, CCB_GLOBAL_COORDS);
+ ccbaGenerateSPGlobalLocs(ccba, CCB_SAVE_TURNING_PTS);
+ pixc = ccbaDisplayImage2(ccba);
+
+ pixDestroy(&pixs);
+ pixDestroy(&pixc);
+ ccbaDestroy(&ccba);
+ return 0;
+}