When running the fuzzers  in `master` with ASan and UBSan enabled the crashes below will eventually be encountered.

Ideally one should be able to run all fuzzers in `master` continuously with all sanitisers enabled without ever hitting any issues.

Note that the presence of an issue in the list below does not necessarily imply a bug in the code under test: it could simply mean that the harness is fuzzing code that is not intended to be robust against random input.

Thus avoiding these issues will require either:
- a.) making the fuzzing harness avoid triggering code that is not meant to be robust to random input, or
- b.) making the code under test more robust.

Some of these will be easy to fix and could thus be good candidates for a "good first issue" :)

| Fuzzer  | Issue | Fix PR |
| ------------- | ------------- | --- |
| `blockundo_deserialize`  | `undo.h:30:24: runtime error: signed integer overflow: 1972491776 * 2 cannot be represented in type 'int'` | – |
| `coins_deserialize`  | `coins.h:62:33: runtime error: signed integer overflow: 1969937248 * 2 cannot be represented in type 'int'` | – |
| `parse_iso8601`  | `util/time.cpp:101:67: runtime error: signed integer overflow: 2147482930 + 1900 cannot be represented in type 'int'` | Fixed by #18162 |
| `parse_script`  | `script/script.h:332:35: runtime error: negation of -9223372036854775808 cannot be represented in type 'int64_t' (aka 'long'); cast to an unsigned type to negate this value to itself` | Fixed by #18416 |
| `psbt`  | `prevector.h:453:19: runtime error: reference binding to misaligned address 0x7f5c1d552022 for type 'prevector<28, unsigned char, unsigned int, int>::size_type' (aka 'unsigned int'), which requires 4 byte alignment` | Fixed by #17708 |
| `script`  | `prevector.h:453:19: runtime error: reference binding to misaligned address 0x7f182c5a5a22 for type 'prevector<28, unsigned char, unsigned int, int>::size_type' (aka 'unsigned int'), which requires 4 byte alignment` | Fixed by #17708 |
| `transaction`  | `primitives/transaction.cpp:87:19: runtime error: signed integer overflow: 1095216725760 + 9223372032559808512 cannot be represented in type 'long'` | Fixed by #18383 |
| `txundo_deserialize`  | `undo.h:30:24: runtime error: signed integer overflow: 1960862720 * 2 cannot be represented in type 'int'` | – |

To reproduce:

```
$ make distclean
$ ./autogen.sh
$ CC=clang CXX=clang++ ./configure --enable-fuzz \
      --with-sanitizers=address,fuzzer,undefined
$ make
$ export UBSAN_OPTIONS="print_stacktrace=1:halt_on_error=1:report_error_type=1"

$ xxd -p -r <<< "d10000b401018dd88dd7001b0a06" > crash-blockundo_deserialize
$ src/test/fuzz/blockundo_deserialize crash-blockundo_deserialize
undo.h:30:24: runtime error: signed integer overflow: 1972491776 * 2 cannot be represented in type 'int'
    #0 0x555b1634e7db in void TxInUndoSerializer::Serialize<CDataStream>(CDataStream&) const src/./undo.h:30:24
    #1 0x555b1634da3a in void Serialize<CDataStream, TxInUndoSerializer>(CDataStream&, TxInUndoSerializer const&) src/./serialize.h:667:7
    #2 0x555b1634da3a in void CTxUndo::Serialize<CDataStream>(CDataStream&) const src/./undo.h:81:13
    #3 0x555b16348fc1 in void Serialize<CDataStream, CTxUndo>(CDataStream&, CTxUndo const&) src/./serialize.h:667:7
    #4 0x555b16348fc1 in void Serialize_impl<CDataStream, CTxUndo, std::allocator<CTxUndo>, CTxUndo>(CDataStream&, std::vector<CTxUndo, std::allocator<CTxUndo> > const&, CTxUndo const&) src/./serialize.h:798:9
    #5 0x555b16348b40 in void Serialize<CDataStream, CTxUndo, std::allocator<CTxUndo> >(CDataStream&, std::vector<CTxUndo, std::allocator<CTxUndo> > const&) src/./serialize.h:804:5
    #6 0x555b16348b40 in void SerializeMany<CDataStream, std::vector<CTxUndo, std::allocator<CTxUndo> > >(CDataStream&, std::vector<CTxUndo, std::allocator<CTxUndo> > const&) src/./serialize.h:1029:5
    #7 0x555b16348b40 in void SerReadWriteMany<CDataStream, std::vector<CTxUndo, std::allocator<CTxUndo> > >(CDataStream&, CSerActionSerialize, std::vector<CTxUndo, std::allocator<CTxUndo> > const&) src/./serialize.h:1048:5
    #8 0x555b16348896 in void CBlockUndo::SerializationOp<CDataStream, CSerActionSerialize>(CDataStream&, CSerActionSerialize) src/./undo.h:110:9
    #9 0x555b16348896 in void CBlockUndo::Serialize<CDataStream>(CDataStream&) const src/./undo.h:106:5
    #10 0x555b16348896 in void Serialize<CDataStream, CBlockUndo>(CDataStream&, CBlockUndo const&) src/./serialize.h:667:7
    #11 0x555b1634851f in CDataStream& CDataStream::operator<<<CBlockUndo>(CBlockUndo const&) src/./streams.h:452:9
    #12 0x555b163377c5 in CDataStream (anonymous namespace)::Serialize<CBlockUndo>(CBlockUndo const&) src/test/fuzz/deserialize.cpp:49:8
    #13 0x555b163334e0 in void (anonymous namespace)::DeserializeFromFuzzingInput<CBlockUndo>(std::vector<unsigned char, std::allocator<unsigned char> > const&, CBlockUndo&) src/test/fuzz/deserialize.cpp:77:5
    #14 0x555b1633314b in test_one_input(std::vector<unsigned char, std::allocator<unsigned char> > const&) src/test/fuzz/deserialize.cpp:178:9

$ xxd -p -r <<< "f60a20008dd5d5ec400006" > crash-coins_deserialize
$ src/test/fuzz/coins_deserialize crash-coins_deserialize
coins.h:62:33: runtime error: signed integer overflow: 1969937248 * 2 cannot be represented in type 'int'
    #0 0x557d369a4be5 in void Coin::Serialize<CDataStream>(CDataStream&) const src/./coins.h:62:33
    #1 0x557d369a45fb in void Serialize<CDataStream, Coin>(CDataStream&, Coin const&) src/./serialize.h:667:7
    #2 0x557d369a45fb in CDataStream& CDataStream::operator<<<Coin>(Coin const&) src/./streams.h:452:9
    #3 0x557d3699d325 in CDataStream (anonymous namespace)::Serialize<Coin>(Coin const&) src/test/fuzz/deserialize.cpp:49:8
    #4 0x557d36998a60 in void (anonymous namespace)::DeserializeFromFuzzingInput<Coin>(std::vector<unsigned char, std::allocator<unsigned char> > const&, Coin&) src/test/fuzz/deserialize.cpp:77:5
    #5 0x557d369986bd in test_one_input(std::vector<unsigned char, std::allocator<unsigned char> > const&) src/test/fuzz/deserialize.cpp:181:9

$ xxd -p -r <<< "7200393636e2f031" > crash-parse_iso8601
$ src/test/fuzz/parse_iso8601 crash-parse_iso8601
util/time.cpp:101:67: runtime error: signed integer overflow: 2147482930 + 1900 cannot be represented in type 'int'
    #0 0x562ccf9bd323 in FormatISO8601DateTime[abi:cxx11](long) src/util/time.cpp:101:67
    #1 0x562ccf9ba5fb in test_one_input(std::vector<unsigned char, std::allocator<unsigned char> > const&) src/test/fuzz/parse_iso8601.cpp:21:42

$ xxd -p -r <<< "2d360932445550092d36093609092d393939393939393939393939393939393939360955" > crash-parse_script
$ src/test/fuzz/parse_script crash-parse_script
script/script.h:332:35: runtime error: negation of -9223372036854775808 cannot be represented in type 'int64_t' (aka 'long'); cast to an unsigned type to negate this value to itself
    #0 0x55e134173738 in CScriptNum::serialize(long const&) src/./script/script.h:332:35
    #1 0x55e134172f40 in CScript::push_int64(long) src/./script/script.h:405:22
    #2 0x55e13416984f in CScript::operator<<(long) src/./script/script.h:445:45
    #3 0x55e13416984f in ParseScript(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) src/core_read.cpp:62:20
    #4 0x55e134167b0b in test_one_input(std::vector<unsigned char, std::allocator<unsigned char> > const&) src/test/fuzz/parse_script.cpp:13:15

$ xxd -p -r <<< "70736274ff010085830303230309006d0000003c000000006f1a30ff0002b37700726b65721a1a0000000000000000000000000000000000000000000000280040009e2900000000000000000000000000000000000000040000000000000070736274ff01002e00000000000303030303030300000000e51a360000010303000000000000000000000000000000000101090000000000000000000000" > crash-psbt
$ src/test/fuzz/psbt crash-psbt
prevector.h:453:19: runtime error: reference binding to misaligned address 0x7f5c1d552022 for type 'prevector<28, unsigned char, unsigned int, int>::size_type' (aka 'unsigned int'), which requires 4 byte alignment
0x7f5c1d552022: note: pointer points here
 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00
              ^
    #0 0x555e737c657e in prevector<28u, unsigned char, unsigned int, int>::swap(prevector<28u, unsigned char, unsigned int, int>&) src/./prevector.h:453:9
    #1 0x555e737c61be in prevector<28u, unsigned char, unsigned int, int>::operator=(prevector<28u, unsigned char, unsigned int, int>&&) src/./prevector.h:273:9
    #2 0x555e737c61be in CScript::operator=(CScript&&) src/./script/script.h:390:7
    #3 0x555e7383a4e6 in ProduceSignature(SigningProvider const&, BaseSignatureCreator const&, CScript const&, SignatureData&) src/script/sign.cpp:245:23
    #4 0x555e737e91a8 in SignPSBTInput(SigningProvider const&, PartiallySignedTransaction&, int, int, SignatureData*, bool) src/psbt.cpp:285:24
    #5 0x555e73780ff5 in AnalyzePSBT(PartiallySignedTransaction) src/node/psbt.cpp:64:29
    #6 0x555e73745694 in test_one_input(std::vector<unsigned char, std::allocator<unsigned char> > const&) src/test/fuzz/psbt.cpp:35:35

$ touch crash-script
$ src/test/fuzz/script crash-script
prevector.h:453:19: runtime error: reference binding to misaligned address 0x7f182c5a5a22 for type 'prevector<28, unsigned char, unsigned int, int>::size_type' (aka 'unsigned int'), which requires 4 byte alignment
0x7f182c5a5a22: note: pointer points here
 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00
              ^
    #0 0x55867c4d0c5e in prevector<28u, unsigned char, unsigned int, int>::swap(prevector<28u, unsigned char, unsigned int, int>&) src/./prevector.h:453:9
    #1 0x55867c4c989e in prevector<28u, unsigned char, unsigned int, int>::operator=(prevector<28u, unsigned char, unsigned int, int>&&) src/./prevector.h:273:9
    #2 0x55867c4c989e in CScript::operator=(CScript&&) src/./script/script.h:390:7
    #3 0x55867c5564c6 in ProduceSignature(SigningProvider const&, BaseSignatureCreator const&, CScript const&, SignatureData&) src/script/sign.cpp:245:23
    #4 0x55867c5604f9 in IsSolvable(SigningProvider const&, CScript const&) src/script/sign.cpp:444:9
    #5 0x55867c4b6647 in test_one_input(std::vector<unsigned char, std::allocator<unsigned char> > const&) src/test/fuzz/script.cpp:48:11

$ xxd -p -r <<< "fb67656c70000000000200ff0000ff0000000000000000ffffff7f0000000000" > crash-transaction
$ src/test/fuzz/transaction crash-transaction
primitives/transaction.cpp:87:19: runtime error: signed integer overflow: 1095216725760 + 9223372032559808512 cannot be represented in type 'long'
    #0 0x5574b725f6c1 in CTransaction::GetValueOut() const src/primitives/transaction.cpp:87:19
    #1 0x5574b611e5bb in test_one_input(std::vector<unsigned char, std::allocator<unsigned char> > const&) src/test/fuzz/transaction.cpp:71:18

$ xxd -p -r <<< "d1000000018dcd828f01000006" > crash-txundo_deserialize
$ src/test/fuzz/txundo_deserialize crash-txundo_deserialize
undo.h:30:24: runtime error: signed integer overflow: 1960862720 * 2 cannot be represented in type 'int'
    #0 0x55e6eb9ae8bb in void TxInUndoSerializer::Serialize<CDataStream>(CDataStream&) const src/./undo.h:30:24
    #1 0x55e6eb9a99ba in void Serialize<CDataStream, TxInUndoSerializer>(CDataStream&, TxInUndoSerializer const&) src/./serialize.h:667:7
    #2 0x55e6eb9a99ba in void CTxUndo::Serialize<CDataStream>(CDataStream&) const src/./undo.h:81:13
    #3 0x55e6eb9a93eb in void Serialize<CDataStream, CTxUndo>(CDataStream&, CTxUndo const&) src/./serialize.h:667:7
    #4 0x55e6eb9a93eb in CDataStream& CDataStream::operator<<<CTxUndo>(CTxUndo const&) src/./streams.h:452:9
    #5 0x55e6eb99c3d5 in CDataStream (anonymous namespace)::Serialize<CTxUndo>(CTxUndo const&) src/test/fuzz/deserialize.cpp:49:8
    #6 0x55e6eb9987f0 in void (anonymous namespace)::DeserializeFromFuzzingInput<CTxUndo>(std::vector<unsigned char, std::allocator<unsigned char> > const&, CTxUndo&) src/test/fuzz/deserialize.cpp:77:5
    #7 0x55e6eb99845b in test_one_input(std::vector<unsigned char, std::allocator<unsigned char> > const&) src/test/fuzz/deserialize.cpp:175:9
```
{
    return ::GetSerializeSize(*this, PROTOCOL_VERSION);
}
std::string CTransaction::ToString() const
{
    std::string str;
    str += strprintf("CTransaction(hash=%s, ver=%d, vin.size=%u, vout.size=%u, nLockTime=%u)\n",
        GetHash().ToString().substr(0,10),
        nVersion,
        vin.size(),
        vout.size(),
        nLockTime);
    for (const auto& tx_in : vin)
        str += "    " + tx_in.ToString() + "\n";
    for (const auto& tx_in : vin)
        str += "    " + tx_in.scriptWitness.ToString() + "\n";
    for (const auto& tx_out : vout)
        str += "    " + tx_out.ToString() + "\n";
    return str;
}