test: Add fuzzing harnesses for various classes/functions in util/ #18736

pull practicalswift wants to merge 8 commits into bitcoin:master from practicalswift:fuzzers-2020-04-21 changing 7 files +189 −5
  1. practicalswift commented at 2:22 PM on April 22, 2020: contributor

    Add fuzzing harnesses for various classes/functions in util/.

    See doc/fuzzing.md for information on how to fuzz Bitcoin Core. Don't forget to contribute any coverage increasing inputs you find to the Bitcoin Core fuzzing corpus repo.

    Happy fuzzing :)

  2. in src/test/fuzz/kitchen_sink.cpp:14 in 9014c59d55 outdated
       8 | +#include <util/error.h>
       9 | +
      10 | +#include <cstdint>
      11 | +#include <vector>
      12 | +
      13 | +// The fuzzing kitchen sink: Fuzzing harness for functions that need to be
    


    MarcoFalke commented at 2:29 PM on April 22, 2020:

    lol

  3. in src/test/fuzz/kitchen_sink.cpp:24 in 9014c59d55 outdated
      16 | +void test_one_input(const std::vector<uint8_t>& buffer)
      17 | +{
      18 | +    FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size());
      19 | +
      20 | +    const TransactionError transaction_error = fuzzed_data_provider.PickValueInArray<TransactionError>({TransactionError::OK, TransactionError::MISSING_INPUTS, TransactionError::ALREADY_IN_CHAIN, TransactionError::P2P_DISABLED, TransactionError::MEMPOOL_REJECTED, TransactionError::MEMPOOL_ERROR, TransactionError::INVALID_PSBT, TransactionError::PSBT_MISMATCH, TransactionError::SIGHASH_MISMATCH, TransactionError::MAX_FEE_EXCEEDED});
      21 | +    (void)TransactionErrorString(transaction_error);
    


    MarcoFalke commented at 2:33 PM on April 22, 2020:

    Is this not string.cpp related?


    practicalswift commented at 2:36 PM on April 22, 2020:

    src/test/fuzz/string.cpp is used for fuzzing functions taking std::string or std::vector<std::string> as inputs whereas this one takes a TransactionError as input (the only method doing so).

    I think this one deserves to be in the new "anything goes" kitchen_sink.cpp due to lack of a more appropriate home :)

  4. MarcoFalke commented at 2:33 PM on April 22, 2020: member

    ACK 9014c59d55f912e7d161d49cd3c21c00b2f15a55

  5. practicalswift commented at 2:43 PM on April 22, 2020: contributor

    @MarcoFalke Thanks a lot for the super quick review. I added another commit which adds fuzzing coverage for two functions (JSONRPCTransactionError and RPCErrorFromTransactionError) by re-using the same TransactionError object used for fuzzing TransactionErrorString. Please re-review :)

  6. DrahtBot added the label Build system on Apr 22, 2020
  7. DrahtBot added the label Tests on Apr 22, 2020
  8. practicalswift renamed this:
    tests: Add fuzzing harnesses for various classes/functions in util/
    test: Add fuzzing harnesses for various classes/functions in util/
    on Apr 24, 2020
  9. DrahtBot commented at 12:47 PM on April 24, 2020: member

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #18775 (tests: Add fuzzing harnesses for various classes/functions in policy/ (CBlockPolicyEstimator, IsRBFOptIn(…), etc.) by practicalswift)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

  10. DrahtBot added the label Needs rebase on Apr 25, 2020
  11. practicalswift force-pushed on Apr 26, 2020
  12. practicalswift commented at 8:18 PM on April 26, 2020: contributor

    Rebased! :)

  13. DrahtBot removed the label Needs rebase on Apr 26, 2020
  14. tests: Add fuzzing harness for functions in system.h (ArgsManager) a19598cf98
  15. tests: Add fuzzing coverage for StringForFeeReason(...) a4e3d13df6
  16. tests: Add fuzzing coverage for CHECK_NONFATAL(...) 90b635e84e
  17. tests: Add fuzzing coverage for FormatHDKeypath(...) and WriteHDKeypath(...) 1532259fca
  18. tests: Add fuzzing coverage for ParseFixedPoint(...) dde508b8b0
  19. tests: Add fuzzing coverage for TransactionErrorString(...) 103b6ecce0
  20. tests: Add fuzzing coverage for JSONRPCTransactionError(...) and RPCErrorFromTransactionError(...) e1e181fad1
  21. practicalswift force-pushed on Apr 26, 2020
  22. tests: Sort fuzzing harnesses 32b6b386a5
  23. MarcoFalke merged this on Apr 29, 2020
  24. MarcoFalke closed this on Apr 29, 2020

  25. sidhujag referenced this in commit 2eecd58ff2 on May 2, 2020
  26. Fabcien referenced this in commit 90e448c74d on Jan 22, 2021
  27. practicalswift deleted the branch on Apr 10, 2021
  28. kittywhiskers referenced this in commit 0fad3638a8 on Aug 11, 2022
  29. DrahtBot locked this on Aug 16, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-16 15:14 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me