address_tracker_linux_fuzzer.cc 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. // Copyright 2019 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 "base/callback_helpers.h"
  7. #include "net/base/address_tracker_linux.h"
  8. namespace net {
  9. namespace internal {
  10. class AddressTrackerLinuxTest {
  11. public:
  12. static void TestHandleMessage(const char* buffer, size_t length) {
  13. std::unordered_set<std::string> ignored_interfaces;
  14. AddressTrackerLinux tracker(base::DoNothing(), base::DoNothing(),
  15. base::DoNothing(), ignored_interfaces);
  16. bool address_changed, link_changed, tunnel_changed;
  17. tracker.HandleMessage(buffer, length, &address_changed, &link_changed,
  18. &tunnel_changed);
  19. }
  20. };
  21. // Entry point for LibFuzzer.
  22. extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
  23. if (size == 0)
  24. return 0;
  25. AddressTrackerLinuxTest::TestHandleMessage(
  26. reinterpret_cast<const char*>(data), size);
  27. return 0;
  28. }
  29. } // namespace internal
  30. } // namespace net