Skip to content

Conversation

practicalswift
Copy link
Contributor

Implement fuzzed_dns_lookup_function as a lambda.

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

Copy link
Contributor

@vasild vasild left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 7c8c140

const std::string name = fuzzed_data_provider.ConsumeRandomLengthString(512);
const unsigned int max_results = fuzzed_data_provider.ConsumeIntegral<unsigned int>();
const bool allow_lookup = fuzzed_data_provider.ConsumeBool();
const int default_port = fuzzed_data_provider.ConsumeIntegral<int>();

auto fuzzed_dns_lookup_function = [&](const std::string&, bool) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

YAGNI (you ain't gonna need it)

@maflcko
Copy link
Member

maflcko commented Mar 15, 2021

cr ACK 7c8c140

Copy link
Member

@jonatack jonatack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested ACK 7c8c140

@maflcko maflcko merged commit 9a5e097 into bitcoin:master Mar 15, 2021
@jonatack
Copy link
Member

3rd time today my ACK missed a merge by a few seconds...there are days like that :D

@practicalswift practicalswift deleted the λ branch April 10, 2021 19:46
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Aug 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants