dns_query_parse_fuzzer.cc 591 B

1234567891011121314151617181920
  1. // Copyright (c) 2018 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #include <stddef.h>
  5. #include <stdint.h>
  6. #include <memory>
  7. #include "net/base/io_buffer.h"
  8. #include "net/dns/dns_query.h"
  9. // Entry point for LibFuzzer.
  10. extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
  11. auto packet = base::MakeRefCounted<net::IOBufferWithSize>(size);
  12. memcpy(packet->data(), data, size);
  13. auto out = std::make_unique<net::DnsQuery>(packet);
  14. out->Parse(size);
  15. return 0;
  16. }