summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'leptonica/prog/fuzzing/barcode_fuzzer.cc')
-rw-r--r--leptonica/prog/fuzzing/barcode_fuzzer.cc22
1 files changed, 22 insertions, 0 deletions
diff --git a/leptonica/prog/fuzzing/barcode_fuzzer.cc b/leptonica/prog/fuzzing/barcode_fuzzer.cc
new file mode 100644
index 00000000..d4dc01ec
--- /dev/null
+++ b/leptonica/prog/fuzzing/barcode_fuzzer.cc
@@ -0,0 +1,22 @@
+#include "leptfuzz.h"
+#include "readbarcode.h"
+
+extern "C" int
+LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
+{
+ if(size<3) return 0;
+ PIX *pixs;
+ SARRAY *saw1, *sad1;
+
+ leptSetStdNullHandler();
+
+ pixs = pixReadMemSpix(data, size);
+ if(pixs == NULL) return 0;
+
+ sad1 = pixProcessBarcodes(pixs, L_BF_ANY, L_USE_WIDTHS, &saw1, 1);
+
+ pixDestroy(&pixs);
+ sarrayDestroy(&saw1);
+ sarrayDestroy(&sad1);
+ return 0;
+}