Changeset View
Changeset View
Standalone View
Standalone View
src/test/fuzz/string.cpp
// Copyright (c) 2020 The Bitcoin Core developers | // Copyright (c) 2020 The Bitcoin Core developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#include <blockfilter.h> | #include <blockfilter.h> | ||||
#include <clientversion.h> | #include <clientversion.h> | ||||
#include <logging.h> | #include <logging.h> | ||||
#include <netbase.h> | #include <netbase.h> | ||||
#include <outputtype.h> | #include <outputtype.h> | ||||
#include <rpc/client.h> | #include <rpc/client.h> | ||||
#include <rpc/request.h> | #include <rpc/request.h> | ||||
#include <rpc/server.h> | #include <rpc/server.h> | ||||
#include <rpc/util.h> | #include <rpc/util.h> | ||||
#include <script/descriptor.h> | #include <script/descriptor.h> | ||||
#include <script/script.h> | |||||
#include <serialize.h> | #include <serialize.h> | ||||
#include <streams.h> | #include <streams.h> | ||||
#include <util/error.h> | #include <util/error.h> | ||||
#include <util/message.h> | #include <util/message.h> | ||||
#include <util/settings.h> | #include <util/settings.h> | ||||
#include <util/strencodings.h> | #include <util/strencodings.h> | ||||
#include <util/string.h> | #include <util/string.h> | ||||
#include <util/system.h> | #include <util/system.h> | ||||
▲ Show 20 Lines • Show All 71 Lines • ▼ Show 20 Lines | void test_one_input(const std::vector<uint8_t> &buffer) { | ||||
(void)TimingResistantEqual(random_string_1, random_string_2); | (void)TimingResistantEqual(random_string_1, random_string_2); | ||||
(void)ToLower(random_string_1); | (void)ToLower(random_string_1); | ||||
(void)ToUpper(random_string_1); | (void)ToUpper(random_string_1); | ||||
(void)TrimString(random_string_1); | (void)TrimString(random_string_1); | ||||
(void)TrimString(random_string_1, random_string_2); | (void)TrimString(random_string_1, random_string_2); | ||||
(void)urlDecode(random_string_1); | (void)urlDecode(random_string_1); | ||||
(void)ValidAsCString(random_string_1); | (void)ValidAsCString(random_string_1); | ||||
(void)_(random_string_1.c_str()); | (void)_(random_string_1.c_str()); | ||||
try { | |||||
throw scriptnum_error{random_string_1}; | |||||
} catch (const std::runtime_error &) { | |||||
} | |||||
{ | { | ||||
CDataStream data_stream{SER_NETWORK, INIT_PROTO_VERSION}; | CDataStream data_stream{SER_NETWORK, INIT_PROTO_VERSION}; | ||||
std::string s; | std::string s; | ||||
LimitedString<10> limited_string = LIMITED_STRING(s, 10); | LimitedString<10> limited_string = LIMITED_STRING(s, 10); | ||||
data_stream << random_string_1; | data_stream << random_string_1; | ||||
try { | try { | ||||
data_stream >> limited_string; | data_stream >> limited_string; | ||||
Show All 33 Lines |