dogecoin/src
MarcoFalke bb03765e2d
Merge #17685: tests: Fix bug in the descriptor parsing fuzzing harness (descriptor_parse)
6338c02034 tests: Fix fuzzing harness for descriptor parsing (descriptor_parse) (practicalswift)

Pull request description:

  Fix bug in the descriptor parsing fuzzing harness (`descriptor_parse`) by making sure `secp256k1_context_verify` is properly initialized (via `ECCVerifyHandle`).

  Background:

  When fuzzing `Parse(…)` with `libFuzzer` I eventually reached the test case `combo(020000000000000000000000000000000000000000000000000000000000000000)`. That input triggers a call to `CPubKey::IsFullyValid()` which in turns requires an initialized `secp256k1_context_verify`.

  The fuzzing harness did not fulfil that pre-condition prior to this commit (sorry, my fault!) :)

  Before:

  ```
  $ mkdir descriptors/
  $ echo -n 'combo(020000000000000000000000000000000000000000000000000000000000000000)' > descriptors/input
  $ UBSAN_OPTIONS="print_stacktrace=1:halt_on_error=1" src/test/fuzz/descriptor_parse -runs=1 descriptors/
  …
  pubkey.cpp:210:38: runtime error: null pointer passed as argument 1, which is declared to never be null
  secp256k1/include/secp256k1.h:305:3: note: nonnull attribute specified here
      #0 0x561c032ccf25 in CPubKey::IsFullyValid() const src/pubkey.cpp:210:12
      #1 0x561c022139c3 in (anonymous namespace)::ParsePubkeyInner(Span<char const> const&, bool, FlatSigningProvider&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) src/script/descriptor.cpp:674:24
      #2 0x561c02207680 in (anonymous namespace)::ParsePubkey(Span<char const> const&, bool, FlatSigningProvider&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) src/script/descriptor.cpp:730:42
      #3 0x561c0220080e in (anonymous namespace)::ParseScript(Span<char const>&, (anonymous namespace)::ParseScriptContext, FlatSigningProvider&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) src/script/descriptor.cpp:774:23
      #4 0x561c021ffb07 in Parse(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, FlatSigningProvider&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, bool) src/script/descriptor.cpp:994:16
      #5 0x561c0218d5d4 in test_one_input(std::vector<unsigned char, std::allocator<unsigned char> > const&) src/test/fuzz/descriptor_parse.cpp:20:9
  …
  $
  ```

  After:

  ```
  $ mkdir descriptors/
  $ echo -n 'combo(020000000000000000000000000000000000000000000000000000000000000000)' > descriptors/input
  $ UBSAN_OPTIONS="print_stacktrace=1:halt_on_error=1" src/test/fuzz/descriptor_parse -runs=1 descriptors/
  …
  Done 2 runs in 0 second(s)
  $
  ```

ACKs for top commit:
  paymog:
    ACK 6338c02034
  MarcoFalke:
    ACK 6338c02034 🕊

Tree-SHA512: bf24c404e1f64183761b057d2f210c3db85277f4415122977c315d7d6835acb5e897b5d64032615e9e44ad4a16dfe857e94481f6e4b57b6dfa8cb37adb2528a5
2019-12-08 13:17:23 -05:00
..
bench scripted-diff: test: Move setup_common to test library 2019-11-06 11:56:41 -05:00
compat [MOVEONLY] Move cpuid code from random & sha256 to compat/cpuid 2019-11-12 14:50:44 -08:00
config
consensus net: Fix uninitialized read in ProcessMessage(...) 2019-11-27 21:27:56 +00:00
crypto Report amount of data gathered from environment 2019-11-12 15:35:26 -08:00
index Remove unused includes 2019-10-15 22:56:43 +00:00
interfaces Merge #16944: gui: create PSBT with watch-only wallet 2019-11-23 09:22:02 +13:00
leveldb
logging logs: add BCLog::Timer and related macros 2019-11-04 14:13:52 -05:00
node node: Add reference to mempool in NodeContext 2019-11-15 13:40:00 -05:00
policy refactor: Remove redundant c_str() calls in formatting 2019-10-28 13:31:33 +01:00
primitives Remove unused includes 2019-10-15 22:56:43 +00:00
qt Use correct C++11 header for std::swap() 2019-11-29 21:23:25 +02:00
rpc wallet: replace raw pointer with const reference in AddrToPubKey 2019-11-24 22:53:42 +01:00
script Merge #17439: refactor: Use proper MAX_SCRIPT_ELEMENT_SIZE constants consistently 2019-11-21 10:11:06 -05:00
secp256k1
support Fix segfault in allocator_tests/arena_tests 2019-11-16 10:43:37 -08:00
test tests: Fix fuzzing harness for descriptor parsing (descriptor_parse) 2019-12-06 18:25:51 +00:00
univalue Update univalue subtree 2019-10-30 16:24:02 -04:00
util util: make ScheduleBatchPriority advisory only 2019-11-26 09:55:07 -05:00
wallet Merge #17373: wallet: Various fixes and cleanup to keypool handling in LegacyScriptPubKeyMan and CWallet 2019-12-06 13:37:30 -05:00
zmq Pass block height in Chain::BlockConnected/Chain::BlockDisconnected 2019-11-05 12:59:16 -05:00
.clang-format util: Add AllowShortCaseLabelsOnASingleLine option 2019-10-14 13:24:54 +03:00
addrdb.cpp
addrdb.h refactor: Remove addrdb.h dependency from node.h 2019-10-29 11:30:12 +02:00
addrman.cpp
addrman.h
amount.h
arith_uint256.cpp Remove unused includes 2019-10-15 22:56:43 +00:00
arith_uint256.h Remove unused includes 2019-10-15 22:56:43 +00:00
attributes.h
banman.cpp
banman.h Merge #17297: refactor: Remove addrdb.h dependency from node.h 2019-11-04 13:18:27 +01:00
base58.cpp
base58.h
bech32.cpp Add some general std::vector utility functions 2019-10-16 08:56:57 -07:00
bech32.h
bitcoin-cli-res.rc
bitcoin-cli.cpp util: remove unwanted fields from bitcoin-cli -getinfo 2019-12-04 06:48:53 +00:00
bitcoin-tx-res.rc
bitcoin-tx.cpp refactor: Remove redundant c_str() calls in formatting 2019-10-28 13:31:33 +01:00
bitcoin-wallet-res.rc
bitcoin-wallet.cpp doc: rename wallet-tool references to bitcoin-wallet 2019-12-02 12:06:35 -05:00
bitcoind-res.rc
bitcoind.cpp Merge #16839: Replace Connman and BanMan globals with NodeContext local 2019-10-30 12:35:41 +01:00
blockencodings.cpp [validation] Add CValidationState subclasses 2019-10-29 15:46:45 -04:00
blockencodings.h Remove unused includes 2019-10-15 22:56:43 +00:00
blockfilter.cpp
blockfilter.h
bloom.cpp
bloom.h p2p: Avoid allocating memory for addrKnown where we don't need it 2019-10-16 17:06:20 -04:00
chain.cpp
chain.h chain: Set all CBlockIndex members to null, remove SetNull helper 2019-10-16 13:06:50 -04:00
chainparams.cpp fix uninitialized variable nMinerConfirmationWindow 2019-11-12 17:59:52 -06:00
chainparams.h doc: Remove explicit network name references 2019-11-01 12:06:35 +01:00
chainparamsbase.cpp
chainparamsbase.h doc: Remove explicit network name references 2019-11-01 12:06:35 +01:00
chainparamsseeds.h contrib: Remove invalid nodes from seeds list 2019-10-02 08:51:12 +02:00
checkqueue.h
clientversion.cpp
clientversion.h
coins.cpp
coins.h
compat.h
compressor.cpp Remove unused includes 2019-10-15 22:56:43 +00:00
compressor.h
core_io.h
core_memusage.h
core_read.cpp
core_write.cpp
cuckoocache.h Use correct C++11 header for std::swap() 2019-11-29 21:23:25 +02:00
dbwrapper.cpp
dbwrapper.h Remove unused includes 2019-10-15 22:56:43 +00:00
dummywallet.cpp scripted-diff: Rename InitInterfaces to NodeContext 2019-10-28 10:30:51 -04:00
flatfile.cpp
flatfile.h
fs.cpp Fix occurences of c_str() used with size() to data() 2019-10-28 13:41:45 +01:00
fs.h
hash.cpp
hash.h
httprpc.cpp Fix occurences of c_str() used with size() to data() 2019-10-28 13:41:45 +01:00
httprpc.h Remove unused includes 2019-10-15 22:56:43 +00:00
httpserver.cpp http: add missing header bootlegged by boost < 1.72 2019-10-25 13:11:09 +00:00
httpserver.h Remove unused includes 2019-10-15 22:56:43 +00:00
indirectmap.h
init.cpp Fire TransactionRemovedFromMempool from mempool 2019-11-21 21:05:38 +01:00
init.h Pass NodeContext, ConnMan, BanMan references more places 2019-10-28 10:30:51 -04:00
key.cpp Merge #12461: scripted-diff: Rename key size consts to be relative to their class 2019-11-20 12:43:55 +01:00
key.h Merge #12461: scripted-diff: Rename key size consts to be relative to their class 2019-11-20 12:43:55 +01:00
key_io.cpp Remove unused includes 2019-10-15 22:56:43 +00:00
key_io.h
limitedmap.h
logging.cpp scripted-diff: Change BCLog::DB to BCLog::WALLETDB 2019-11-08 18:45:38 +01:00
logging.h scripted-diff: Change BCLog::DB to BCLog::WALLETDB 2019-11-08 18:45:38 +01:00
Makefile.am build: Create test utility library from src/test/util/ 2019-11-21 21:13:08 +01:00
Makefile.bench.include build: Create test utility library from src/test/util/ 2019-11-21 21:13:08 +01:00
Makefile.leveldb.include
Makefile.qt.include Merge #17513: refactor, qt: Nuke some circular dependencies 2019-11-21 19:38:39 +01:00
Makefile.qt_locale.include qt: Periodic translations update 2019-09-30 09:41:11 +02:00
Makefile.qttest.include build: Create test utility library from src/test/util/ 2019-11-21 21:13:08 +01:00
Makefile.test.include Merge #17051: tests: Add deserialization fuzzing harnesses 2019-12-06 09:45:26 +01:00
Makefile.test_util.include build: Create test utility library from src/test/util/ 2019-11-21 21:13:08 +01:00
memusage.h
merkleblock.cpp
merkleblock.h
miner.cpp refactor: Remove unused COINBASE_FLAGS 2019-11-20 19:06:52 -05:00
miner.h
net.cpp Seed RNG with precision timestamps on receipt of net messages. 2019-11-23 16:06:34 -05:00
net.h Merge #17243: p2p: add PoissonNextSend method that returns mockable time 2019-11-05 12:38:28 -05:00
net_permissions.cpp
net_permissions.h
net_processing.cpp Merge #17243: p2p: add PoissonNextSend method that returns mockable time 2019-11-05 12:38:28 -05:00
net_processing.h [validation] Add CValidationState subclasses 2019-10-29 15:46:45 -04:00
net_types.h refactor: Remove addrdb.h dependency from node.h 2019-10-29 11:30:12 +02:00
netaddress.cpp
netaddress.h Remove unused includes 2019-10-15 22:56:43 +00:00
netbase.cpp doc: Fix some misspellings 2019-11-04 04:22:53 -05:00
netbase.h
netmessagemaker.h
noui.cpp test: Add ASSERT_DEBUG_LOG to unit test framework 2019-11-04 10:42:33 -05:00
noui.h test: Add ASSERT_DEBUG_LOG to unit test framework 2019-11-04 10:42:33 -05:00
optional.h
outputtype.cpp Add some general std::vector utility functions 2019-10-16 08:56:57 -07:00
outputtype.h
pow.cpp
pow.h
prevector.h Use correct C++11 header for std::swap() 2019-11-29 21:23:25 +02:00
protocol.cpp p2p: Remove BIP61 reject messages 2019-10-02 10:39:14 -04:00
protocol.h Remove unused includes 2019-10-15 22:56:43 +00:00
psbt.cpp Remove unused includes 2019-10-15 22:56:43 +00:00
psbt.h Merge #12461: scripted-diff: Rename key size consts to be relative to their class 2019-11-20 12:43:55 +01:00
pubkey.cpp Merge #17275: pubkey: Assert CPubKey's ECCVerifyHandle precondition 2019-12-06 13:35:37 -05:00
pubkey.h Merge #12461: scripted-diff: Rename key size consts to be relative to their class 2019-11-20 12:43:55 +01:00
random.cpp Move events_hasher into RNGState() 2019-12-05 09:49:11 -08:00
random.h Move events_hasher into RNGState() 2019-12-05 09:49:11 -08:00
randomenv.cpp Put bounds on the number of CPUID leaves explored 2019-11-20 10:54:08 -08:00
randomenv.h [MOVEONLY] Move perfmon data gathering to new randomenv module 2019-11-12 14:50:44 -08:00
rest.cpp Remove unused includes 2019-10-15 22:56:43 +00:00
reverse_iterator.h
reverselock.h
scheduler.cpp Run background seeding periodically instead of unpredictably 2019-11-12 15:35:26 -08:00
scheduler.h
serialize.h Remove unused includes 2019-10-15 22:56:43 +00:00
shutdown.cpp
shutdown.h
span.h
streams.h Remove unused includes 2019-10-15 22:56:43 +00:00
sync.cpp refactor: Remove redundant c_str() calls in formatting 2019-10-28 13:31:33 +01:00
sync.h
threadinterrupt.cpp
threadinterrupt.h Remove unused includes 2019-10-15 22:56:43 +00:00
threadsafety.h
timedata.cpp
timedata.h
tinyformat.h
torcontrol.cpp
torcontrol.h Remove unused includes 2019-10-15 22:56:43 +00:00
txdb.cpp Add some general std::vector utility functions 2019-10-16 08:56:57 -07:00
txdb.h Remove unused includes 2019-10-15 22:56:43 +00:00
txmempool.cpp Fire TransactionRemovedFromMempool from mempool 2019-11-21 21:05:38 +01:00
txmempool.h Remove unnecessary forward declaration 2019-11-09 22:08:29 -08:00
ui_interface.cpp
ui_interface.h Remove unused includes 2019-10-15 22:56:43 +00:00
uint256.cpp Remove unused includes 2019-10-15 22:56:43 +00:00
uint256.h Remove unused includes 2019-10-15 22:56:43 +00:00
undo.h
validation.cpp refactor: Remove unused COINBASE_FLAGS 2019-11-20 19:06:52 -05:00
validation.h Use correct C++11 header for std::swap() 2019-11-29 21:23:25 +02:00
validationinterface.cpp Fire TransactionRemovedFromMempool from mempool 2019-11-21 21:05:38 +01:00
validationinterface.h Fire TransactionRemovedFromMempool from mempool 2019-11-21 21:05:38 +01:00
version.h
versionbits.cpp
versionbits.h
versionbitsinfo.cpp
versionbitsinfo.h
walletinitinterface.h scripted-diff: Rename InitInterfaces to NodeContext 2019-10-28 10:30:51 -04:00
warnings.cpp
warnings.h Remove unused includes 2019-10-15 22:56:43 +00:00