Coverage Report

Created: 2025-10-10 06:58

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/crow/tests/fuzz/b64_fuzzer.cpp
Line
Count
Source
1
#include <cstdint>
2
#include <fuzzer/FuzzedDataProvider.h>
3
4
#include "crow.h"
5
6
class FuzzException : public std::exception
7
{
8
    virtual const char* what() const throw()
9
0
    {
10
0
        return "Base64 decoding error!";
11
0
    }
12
};
13
14
extern "C" int LLVMFuzzerTestOneInput(const std::uint8_t* data, const std::size_t size)
15
441
{
16
441
    FuzzedDataProvider fdp{data, size};
17
18
441
    std::string plaintext = fdp.ConsumeRandomLengthString();
19
441
    std::string encoded = crow::utility::base64encode(plaintext, plaintext.size());
20
441
    std::string decoded = crow::utility::base64decode(encoded, encoded.size());
21
22
441
    if (plaintext != decoded)
23
0
    {
24
0
        throw FuzzException();
25
0
    }
26
441
    return 0;
27
441
}