mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-19 14:53:43 +01:00
Historically, the headers have been bumped some time after a file has been touched. Do it now to avoid having to touch them again in the future for that reason. -BEGIN VERIFY SCRIPT- sed -i --regexp-extended 's;( 20[0-2][0-9])(-20[0-2][0-9])? The Bitcoin Core developers;\1-present The Bitcoin Core developers;g' $( git show --pretty="" --name-only HEAD~1 ) -END VERIFY SCRIPT-
34 lines
1.1 KiB
C++
34 lines
1.1 KiB
C++
// Copyright (c) 2019-present The Bitcoin Core developers
|
|
// Distributed under the MIT software license, see the accompanying
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
#include <script/parsing.h>
|
|
#include <test/fuzz/FuzzedDataProvider.h>
|
|
#include <test/fuzz/fuzz.h>
|
|
#include <util/string.h>
|
|
|
|
using util::Split;
|
|
|
|
FUZZ_TARGET(script_parsing)
|
|
{
|
|
FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size());
|
|
const size_t query_size = fuzzed_data_provider.ConsumeIntegral<size_t>();
|
|
const std::string query = fuzzed_data_provider.ConsumeBytesAsString(std::min<size_t>(query_size, 1024 * 1024));
|
|
const std::string span_str = fuzzed_data_provider.ConsumeRemainingBytesAsString();
|
|
const std::span<const char> const_span{span_str};
|
|
|
|
std::span<const char> mut_span = const_span;
|
|
(void)script::Const(query, mut_span);
|
|
|
|
mut_span = const_span;
|
|
(void)script::Func(query, mut_span);
|
|
|
|
mut_span = const_span;
|
|
(void)script::Expr(mut_span);
|
|
|
|
if (!query.empty()) {
|
|
mut_span = const_span;
|
|
(void)Split(mut_span, query.front());
|
|
}
|
|
}
|