Add fuzzing harness for classes/functions in blockfilter.h.
Add integer serialization/deserialization fuzzing harness.
Add fuzzing harness for classes/functions in blockfilter.h.
Add integer serialization/deserialization fuzzing harness.
<!--e57a25ab6845829454e8d69fc972939a-->
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
<!--174a7506f384e20aa4161008e828411d-->
Reviewers, this pull request conflicts with the following ones:
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.
34 | + (void)gcs_filter.GetN(); 35 | + (void)gcs_filter.GetParams(); 36 | + (void)gcs_filter.GetEncoded(); 37 | + (void)gcs_filter.Match(ConsumeRandomLengthByteVector(fuzzed_data_provider)); 38 | + GCSFilter::ElementSet element_set; 39 | + while (fuzzed_data_provider.ConsumeBool()) {
Why does this need to be consumed? It seems the only purpose of the consumed bool is to exit early. The same can be achieved by the fuzz engine by just not providing any further input. So shouldn't the condition here be fuzzed_data_provider.remaining_bytes()?
Yes, using if (fuzzed_data_provider.remaining_bytes()) { is possible but that would render the seed corpus invalid if we add input consuming code to be fuzzed in blockfilter.cpp going forward.
Using if (fuzzed_data_provider.ConsumeBool()) { instead avoids that problem: we can add code to be fuzzed that consumes input without invalidating the existing seed corpus.
Invalidating in this context means changing the fuzzing coverage for a given input file.
Please note that fuzzed_data_provider.ConsumeBool() will return false if fuzzed_data_provider.remaining_bytes() == 0.