GetQueryParameterFromUri() parses the query string of a request target
supplied by a remote client. It is reached from the REST interface for the
count, offset, size, verbose and mempool_sequence parameters, but had
no fuzz coverage.
This adds an http_query_parameter target. Besides running the parser on
arbitrary input, it round-trips a URL-encoded key/value pair back through it and
checks the cases that are easy to get wrong:
- a parameter with no
=, which is an empty value rather than a missing one - a repeated key, where the first occurrence wins
- a key that occurs both before and after a
#, where the parser must return the value found before the#and ignore the later occurrence, since everything from the fragment separator onwards is not part of the query string
Testing
Built the fuzz binary and ran the new target against a temporary corpus directory, capped at 10,000 executions:
FUZZ=http_query_parameter build_fuzz/bin/fuzz /tmp/corpus_http_query_parameter -runs=10000