Commit 6457d22d authored by Daniel McArdle's avatar Daniel McArdle Committed by Commit Bot

Exercise *Rrdata::Create() functions in net_dns_record_fuzzer

This CL attempts to improve the fuzzer coverage of the various
Create() functions that are invoked by RecordParsed::CreateFrom(),
e.g. ARecordRdata::Create().  See [1] for fuzzer coverage prior to
this CL.

[1]: https://chromium-coverage.appspot.com/reports/699620_fuzzers_only/linux/chromium/src/net/dns/record_rdata.cc.html

Change-Id: Icad9ca987464f76099daf649d9f46f41c1c9ab9d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1829939
Commit-Queue: Dan McArdle <dmcardle@chromium.org>
Reviewed-by: default avatarEric Orth <ericorth@chromium.org>
Cr-Commit-Position: refs/heads/master@{#702856}
parent 89ea6939
......@@ -5,9 +5,13 @@
#include <stddef.h>
#include <stdint.h>
#include <memory>
#include "base/files/file_path.h"
#include "base/logging.h"
#include "base/time/time.h"
#include "net/dns/dns_response.h"
#include "net/dns/record_parsed.h"
void InitLogging() {
// For debugging, it may be helpful to enable verbose logging by setting the
......@@ -29,8 +33,16 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
if (!parser.IsValid()) {
return 0;
}
base::Time time;
std::unique_ptr<const net::RecordParsed> record_parsed;
do {
record_parsed = net::RecordParsed::CreateFrom(&parser, time);
} while (record_parsed);
net::DnsResourceRecord record;
while (parser.ReadRecord(&record)) {
}
return 0;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment