Coverage Report

Created: 2025-07-23 06:09

/src/opendnp3/cpp/tests/fuzz/fuzzdecoder.cpp
Line
Count
Source
1
/*
2
 * Copyright 2013-2022 Step Function I/O, LLC
3
 *
4
 * Licensed to Green Energy Corp (www.greenenergycorp.com) and Step Function I/O
5
 * LLC (https://stepfunc.io) under one or more contributor license agreements.
6
 * See the NOTICE file distributed with this work for additional information
7
 * regarding copyright ownership. Green Energy Corp and Step Function I/O LLC license
8
 * this file to you under the Apache License, Version 2.0 (the "License"); you
9
 * may not use this file except in compliance with the License. You may obtain
10
 * a copy of the License at:
11
 *
12
 * http://www.apache.org/licenses/LICENSE-2.0
13
 *
14
 * Unless required by applicable law or agreed to in writing, software
15
 * distributed under the License is distributed on an "AS IS" BASIS,
16
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
 * See the License for the specific language governing permissions and
18
 * limitations under the License.
19
 */
20
#include <opendnp3/ConsoleLogger.h>
21
#include <opendnp3/decoder/Decoder.h>
22
#include <opendnp3/logging/LogLevels.h>
23
24
using namespace opendnp3;
25
26
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* Data, size_t Size)
27
23.7k
{
28
23.7k
    Buffer buffer(Data, Size);
29
23.7k
    Logger logger(ConsoleLogger::Create(), ModuleId(), "decoder", levels::NOTHING);
30
23.7k
    IDecoderCallbacks callback;
31
23.7k
    Decoder decoder(callback, logger);
32
33
23.7k
    decoder.DecodeLPDU(buffer);
34
35
23.7k
    return 0;
36
23.7k
}