Changeset View
Changeset View
Standalone View
Standalone View
src/test/fuzz/script_flags.cpp
// Copyright (c) 2009-2019 The Bitcoin Core developers | // Copyright (c) 2009-2019 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 <script/interpreter.h> | #include <script/interpreter.h> | ||||
#include <streams.h> | #include <streams.h> | ||||
#include <version.h> | #include <version.h> | ||||
#include <test/fuzz/fuzz.h> | #include <test/fuzz/fuzz.h> | ||||
/** Flags that are not forbidden by an assert */ | /** Flags that are not forbidden by an assert */ | ||||
static bool IsValidFlagCombination(uint32_t flags); | static bool IsValidFlagCombination(uint32_t flags); | ||||
void test_one_input(std::vector<uint8_t> buffer) { | void test_one_input(const std::vector<uint8_t> &buffer) { | ||||
CDataStream ds(buffer, SER_NETWORK, INIT_PROTO_VERSION); | CDataStream ds(buffer, SER_NETWORK, INIT_PROTO_VERSION); | ||||
try { | try { | ||||
int nVersion; | int nVersion; | ||||
ds >> nVersion; | ds >> nVersion; | ||||
ds.SetVersion(nVersion); | ds.SetVersion(nVersion); | ||||
} catch (const std::ios_base::failure &) { | } catch (const std::ios_base::failure &) { | ||||
return; | return; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 56 Lines • Show Last 20 Lines |