mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-08 10:31:50 -05:00
Merge bitcoin/bitcoin#28931: fuzz: Limit fuzz buffer size in script_flags target
faf1fb207f
Fix IWYU for the script_flags fuzz target (MarcoFalke)fa71285b73
fuzz: Limit fuzz buffer size in script_flags target (MarcoFalke)fa6b87b9ee
fuzz: CDataStream -> DataStream in script_flags (MarcoFalke) Pull request description: Most fuzz targets have an upper limit on the buffer size to avoid excessive runtime. Do the same for `script_flags` to avoid timeouts such as https://github.com/bitcoin/bitcoin/issues/28812#issuecomment-1824696971 Also, fix iwyu. Also, remove legacy `CDataStream`. ACKs for top commit: dergoegge: ACKfaf1fb207f
brunoerg: utACKfaf1fb207f
Tree-SHA512: 9301917b353f7409e448b6fd3635de19330856e0742431db5ef04e62873501b5b4cd6cb78ad81ada2747fa2bdae033115b5951d10489dd5d0d320426c8b96bee
This commit is contained in:
commit
5f9fd11680
2 changed files with 19 additions and 20 deletions
|
@ -6,21 +6,23 @@
|
|||
#ifndef BITCOIN_SCRIPT_INTERPRETER_H
|
||||
#define BITCOIN_SCRIPT_INTERPRETER_H
|
||||
|
||||
#include <consensus/amount.h>
|
||||
#include <hash.h>
|
||||
#include <script/script_error.h>
|
||||
#include <span.h>
|
||||
#include <primitives/transaction.h>
|
||||
#include <script/script_error.h> // IWYU pragma: export
|
||||
#include <span.h>
|
||||
#include <uint256.h>
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <optional>
|
||||
#include <vector>
|
||||
#include <stdint.h>
|
||||
|
||||
class CPubKey;
|
||||
class XOnlyPubKey;
|
||||
class CScript;
|
||||
class CTransaction;
|
||||
class CTxOut;
|
||||
class uint256;
|
||||
class CScriptNum;
|
||||
class XOnlyPubKey;
|
||||
struct CScriptWitness;
|
||||
|
||||
/** Signature hash types/flags */
|
||||
enum
|
||||
|
|
|
@ -3,25 +3,22 @@
|
|||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include <consensus/amount.h>
|
||||
#include <pubkey.h>
|
||||
#include <primitives/transaction.h>
|
||||
#include <script/interpreter.h>
|
||||
#include <serialize.h>
|
||||
#include <streams.h>
|
||||
#include <test/util/script.h>
|
||||
#include <version.h>
|
||||
|
||||
#include <test/fuzz/fuzz.h>
|
||||
#include <test/util/script.h>
|
||||
|
||||
#include <cassert>
|
||||
#include <ios>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
FUZZ_TARGET(script_flags)
|
||||
{
|
||||
CDataStream ds(buffer, SER_NETWORK, INIT_PROTO_VERSION);
|
||||
try {
|
||||
int nVersion;
|
||||
ds >> nVersion;
|
||||
ds.SetVersion(nVersion);
|
||||
} catch (const std::ios_base::failure&) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (buffer.size() > 100'000) return;
|
||||
DataStream ds{buffer};
|
||||
try {
|
||||
const CTransaction tx(deserialize, TX_WITH_WITNESS, ds);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue