Coverage Report

Created: 2025-09-27 07:50

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/poppler/qt5/tests/fuzzing/qt_search_fuzzer.cc
Line
Count
Source
1
#include <cstdint>
2
#include <poppler-qt5.h>
3
4
51.7M
static void dummy_error_function(const QString &, const QVariant &) { }
5
6
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
7
61.0k
{
8
61.0k
    Poppler::setDebugErrorFunction(dummy_error_function, QVariant());
9
61.0k
    QByteArray in_data = QByteArray::fromRawData((const char *)data, size);
10
61.0k
    Poppler::Document *doc = Poppler::Document::loadFromData(in_data);
11
61.0k
    if (!doc || doc->isLocked()) {
12
12.4k
        delete doc;
13
12.4k
        return 0;
14
12.4k
    }
15
16
415k
    for (int i = 0; i < doc->numPages(); i++) {
17
367k
        Poppler::Page *p = doc->page(i);
18
367k
        if (!p) {
19
251k
            continue;
20
251k
        }
21
115k
        QString text = QString(in_data);
22
115k
        p->search(text, Poppler::Page::IgnoreCase, Poppler::Page::Rotate0);
23
115k
        delete p;
24
115k
    }
25
26
48.5k
    delete doc;
27
48.5k
    return 0;
28
61.0k
}