Coverage Report

Created: 2026-03-31 07:41

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/poppler/qt6/tests/fuzzing/qt_search_fuzzer.cc
Line
Count
Source
1
#include <cstdint>
2
#include <poppler-qt6.h>
3
4
static void dummy_error_function(const QString &message, const QVariant &closure)
5
551k
{
6
551k
    Q_UNUSED(message)
7
551k
    Q_UNUSED(closure)
8
551k
}
9
10
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
11
52.2k
{
12
52.2k
    Poppler::setDebugErrorFunction(dummy_error_function, QVariant());
13
52.2k
    QByteArray in_data = QByteArray::fromRawData((const char *)data, size);
14
52.2k
    std::unique_ptr<Poppler::Document> doc = Poppler::Document::loadFromData(in_data);
15
52.2k
    if (!doc || doc->isLocked()) {
16
9.54k
        return 0;
17
9.54k
    }
18
19
338k
    for (int i = 0; i < doc->numPages(); i++) {
20
295k
        std::unique_ptr<Poppler::Page> p = doc->page(i);
21
295k
        if (!p) {
22
198k
            continue;
23
198k
        }
24
97.1k
        QString text = QString::fromUtf8(in_data);
25
97.1k
        p->search(text, Poppler::Page::IgnoreCase, Poppler::Page::Rotate0);
26
97.1k
    }
27
28
42.6k
    return 0;
29
52.2k
}