mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-20 07:09:15 +01:00
Merge bitcoin/bitcoin#33886: test: Remove tests violating hardened std::span
fadb4f63cbtest: Remove tests violating hardened std::span (MarcoFalke) Pull request description: Also, add a test for creating a CScript from an empty byte vector. To test: `rm -rf ./bld-cmake && cmake -B ./bld-cmake -DCMAKE_C_COMPILER='clang' -DCMAKE_CXX_COMPILER='clang++;-stdlib=libc++;-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUG' -DBUILD_GUI=OFF -DBUILD_FUZZ_BINARY=OFF -DBUILD_BENCH=OFF -DBUILD_KERNEL_LIB=ON -DENABLE_WALLET=OFF -DENABLE_IPC=OFF && cmake --build ./bld-cmake --parallel $( nproc ) && valgrind --tool=none ./bld-cmake/bin/test_kernel --catch_system_error=no` Before: ``` /cxx_build/include/c++/v1/span:451: libc++ Hardening assertion __count == 0 || std::to_address(__first) != nullptr failed: passed nullptr with non-zero length in span's constructor (iterator, len) ``` After: (Passes) ACKs for top commit: TheCharlatan: ACKfadb4f63cbstickies-v: ACKfadb4f63cbTree-SHA512: 47c2ee975b82978bbb226b47cde337dce5a7e25bc1d70c31f34b9a9ff38477609764c267e47ac5fd71a578fb2b2b135c698bb02dae1777a87bcc4079dcd278ef
This commit is contained in:
@@ -398,7 +398,6 @@ BOOST_AUTO_TEST_CASE(btck_transaction_tests)
|
||||
BOOST_CHECK_THROW(Transaction{invalid_data}, std::runtime_error);
|
||||
auto empty_data = hex_string_to_byte_vec("");
|
||||
BOOST_CHECK_THROW(Transaction{empty_data}, std::runtime_error);
|
||||
BOOST_CHECK_THROW(Transaction{std::span<std::byte>(static_cast<std::byte*>(nullptr), 2)}, std::runtime_error);
|
||||
|
||||
BOOST_CHECK_EQUAL(tx.CountOutputs(), 2);
|
||||
BOOST_CHECK_EQUAL(tx.CountInputs(), 1);
|
||||
@@ -475,7 +474,9 @@ BOOST_AUTO_TEST_CASE(btck_script_pubkey)
|
||||
ScriptPubkey script2{script_data_2};
|
||||
CheckHandle(script, script2);
|
||||
|
||||
BOOST_CHECK_THROW(ScriptPubkey{std::span<std::byte>(static_cast<std::byte*>(nullptr), 2)}, std::runtime_error);
|
||||
std::span<std::byte> empty_data{};
|
||||
ScriptPubkey empty_script{empty_data};
|
||||
CheckHandle(script, empty_script);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(btck_transaction_output)
|
||||
@@ -592,7 +593,6 @@ BOOST_AUTO_TEST_CASE(btck_block)
|
||||
BOOST_CHECK_THROW(Block{invalid_data}, std::runtime_error);
|
||||
auto empty_data = hex_string_to_byte_vec("");
|
||||
BOOST_CHECK_THROW(Block{empty_data}, std::runtime_error);
|
||||
BOOST_CHECK_THROW(Block{std::span<std::byte>(static_cast<std::byte*>(nullptr), 2)}, std::runtime_error);
|
||||
}
|
||||
|
||||
Context create_context(std::shared_ptr<TestKernelNotifications> notifications, ChainType chain_type, std::shared_ptr<TestValidationInterface> validation_interface = nullptr)
|
||||
|
||||
Reference in New Issue
Block a user