Coverage Report

Created: 2024-06-18 06:05

/src/leptonica/prog/fuzzing/morphapp_fuzzer.cc
Line
Count
Source
1
#include "leptfuzz.h"
2
3
extern "C" int
4
1.90k
LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { 
5
1.90k
    if(size<3) return 0;
6
7
1.90k
    leptSetStdNullHandler();
8
9
1.90k
    Pix *pixs_payload = pixReadMemSpix(data, size);
10
1.90k
    if(pixs_payload == NULL) return 0;
11
12
1.29k
    Pix *pix1 = pixRead("../test8.jpg");
13
1.29k
    Pix *pix2 = pixRead("../test8.jpg");
14
1.29k
    Pix *pix_return1 = pixDisplayMatchedPattern(pixs_payload, pix1, pix2,
15
1.29k
                                                1, 2, 3, 0.5, 1);
16
1.29k
    pixDestroy(&pix1);
17
1.29k
    pixDestroy(&pix_return1);
18
1.29k
    pixDestroy(&pix2);
19
20
1.29k
    Pix *pix_return2 = pixFastTophat(pixs_payload, 2, 2, L_TOPHAT_WHITE);
21
1.29k
    pixDestroy(&pix_return2);
22
23
1.29k
    Pix *pix_return3 = pixHDome(pixs_payload, 1, 4);
24
1.29k
    pixDestroy(&pix_return3);
25
26
1.29k
    Sela *sela1 = selaCreate(0);
27
1.29k
    Pix *pix_return4 = pixIntersectionOfMorphOps(pixs_payload,
28
1.29k
                                                 sela1, L_MORPH_DILATE);
29
1.29k
    selaDestroy(&sela1);
30
1.29k
    pixDestroy(&pix_return4);
31
32
1.29k
    Pix *pix_return5 = pixMorphGradient(pixs_payload, 5, 5, 1);
33
1.29k
    pixDestroy(&pix_return5);
34
35
1.29k
    pix1 = pixRead("../test8.jpg");
36
1.29k
    Boxa *boxa1;
37
1.29k
    const char *sequence = "sequence";
38
1.29k
    Pix *pix_return6 = pixMorphSequenceByRegion(pixs_payload, pix1,
39
1.29k
                                                sequence, 4, 1, 1, &boxa1);
40
1.29k
    boxaDestroy(&boxa1);
41
1.29k
    pixDestroy(&pix1);
42
1.29k
    pixDestroy(&pix_return6);
43
44
1.29k
    pix1 = pixRead("../test8.jpg");
45
1.29k
    Pix *pix_return7 = pixMorphSequenceMasked(pixs_payload, pix1, sequence, 0);
46
1.29k
    pixDestroy(&pix1);
47
1.29k
    pixDestroy(&pix_return7);
48
49
1.29k
    pix1 = pixCreate(300, 300, 32);
50
1.29k
    pix2 = pixCreate(300, 300, 32);
51
1.29k
    pixRemoveMatchedPattern(pixs_payload, pix1, pix2, 2, 2, 2);
52
1.29k
    pixDestroy(&pix1);
53
1.29k
    pixDestroy(&pix2);
54
55
1.29k
    Pix *pix = pixCreate(300, 300, 32);
56
1.29k
    Pix *pix_return8 = pixSeedfillMorph(pixs_payload, pix, 0, 4);
57
1.29k
    pixDestroy(&pix_return8);
58
1.29k
    pixDestroy(&pix);
59
60
1.29k
    Pix *pix_return9 = pixSelectiveConnCompFill(pixs_payload, 4, 1, 1);
61
1.29k
    pixDestroy(&pix_return9);
62
63
1.29k
    pixDestroy(&pixs_payload);
64
1.29k
    return 0;
65
1.90k
}