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