Coverage Report

Created: 2026-03-31 11:00

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/vcl/workben/wksfuzzer.cxx
Line
Count
Source
1
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
/*
3
 * This file is part of the LibreOffice project.
4
 *
5
 * This Source Code Form is subject to the terms of the Mozilla Public
6
 * License, v. 2.0. If a copy of the MPL was not distributed with this
7
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8
 */
9
10
#include <tools/stream.hxx>
11
#include <vcl/FilterConfigItem.hxx>
12
#include <com/sun/star/ucb/XContentProvider.hpp>
13
#include <com/sun/star/ucb/XUniversalContentBroker.hpp>
14
#include "commonfuzzer.hxx"
15
16
0
extern "C" void* ScCreateDialogFactory() { return nullptr; }
17
18
extern "C" bool TestImportWKS(SvStream& rStream);
19
20
extern "C" int LLVMFuzzerInitialize(int* argc, char*** argv)
21
14
{
22
14
    if (__lsan_disable)
23
0
        __lsan_disable();
24
25
14
    CommonInitialize(argc, argv);
26
27
    // initialise unconfigured UCB:
28
14
    css::uno::Reference<css::ucb::XUniversalContentBroker> xUcb(
29
14
        comphelper::getProcessServiceFactory()->createInstance(
30
14
            "com.sun.star.ucb.UniversalContentBroker"),
31
14
        css::uno::UNO_QUERY_THROW);
32
14
    css::uno::Sequence<css::uno::Any> aArgs{ css::uno::Any(OUString("NoConfig")) };
33
14
    css::uno::Reference<css::ucb::XContentProvider> xFileProvider(
34
14
        comphelper::getProcessServiceFactory()->createInstanceWithArguments(
35
14
            "com.sun.star.ucb.FileContentProvider", aArgs),
36
14
        css::uno::UNO_QUERY_THROW);
37
14
    xUcb->registerContentProvider(xFileProvider, "file", true);
38
39
14
    if (__lsan_enable)
40
0
        __lsan_enable();
41
42
14
    return 0;
43
14
}
44
45
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
46
393k
{
47
393k
    SvMemoryStream aStream(const_cast<uint8_t*>(data), size, StreamMode::READ);
48
393k
    (void)TestImportWKS(aStream);
49
393k
    return 0;
50
393k
}
51
52
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */