fuzz: Implement fuzzed_dns_lookup_function as a lambda #21443

pull practicalswift wants to merge 1 commits into bitcoin:master from practicalswift:λ changing 1 files +9 −15
  1. practicalswift commented at 3:32 pm on March 15, 2021: contributor

    Implement fuzzed_dns_lookup_function as a lambda.

    As wisely suggested by MarcoFalke in #19415 (review). Thanks! :)

  2. fuzz: Implement fuzzed_dns_lookup_function as lambda 7c8c140ecc
  3. in src/test/fuzz/netbase_dns_lookup.cpp:23 in 7c8c140ecc
    32     const std::string name = fuzzed_data_provider.ConsumeRandomLengthString(512);
    33     const unsigned int max_results = fuzzed_data_provider.ConsumeIntegral<unsigned int>();
    34     const bool allow_lookup = fuzzed_data_provider.ConsumeBool();
    35     const int default_port = fuzzed_data_provider.ConsumeIntegral<int>();
    36+
    37+    auto fuzzed_dns_lookup_function = [&](const std::string&, bool) {
    


    vasild commented at 3:40 pm on March 15, 2021:
    This is impossible to reuse if another FUZZ_TARGET() be added. It is ok since here we have just one FUZZ_TARGET() and if ever another one is added and reuse needed, then it could be done in another way.

    practicalswift commented at 3:47 pm on March 15, 2021:

    I think (and hope) that the netbase_dns_lookup fuzzing harness should cover all our low-level DNS fuzzing needs, so I think the probability that we’ll need to call fuzzed_dns_lookup_function from another FUZZ_TARGET in the future is relatively low.

    In other words: let’s cross that fuzzing bridge when we come to it :)


    jonatack commented at 4:28 pm on March 15, 2021:
    YAGNI (you ain’t gonna need it)
  4. vasild approved
  5. vasild commented at 3:41 pm on March 15, 2021: member
    ACK 7c8c140ecc95ab2ac90e20951416886c9ac5fa93
  6. MarcoFalke commented at 4:26 pm on March 15, 2021: member
    cr ACK 7c8c140ecc95ab2ac90e20951416886c9ac5fa93
  7. jonatack commented at 4:27 pm on March 15, 2021: member
    Tested ACK 7c8c140ecc95ab2ac90e20951416886c9ac5fa93
  8. MarcoFalke merged this on Mar 15, 2021
  9. MarcoFalke closed this on Mar 15, 2021

  10. jonatack commented at 4:30 pm on March 15, 2021: member
    3rd time today my ACK missed a merge by a few seconds…there are days like that :D
  11. practicalswift deleted the branch on Apr 10, 2021
  12. 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: 2024-12-18 18:12 UTC

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