• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2016 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifdef UNSAFE_BUFFERS_BUILD
6 // TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
7 #pragma allow_unsafe_buffers
8 #endif
9 
10 #include <stddef.h>
11 #include <stdint.h>
12 
13 #include "net/proxy_resolution/proxy_bypass_rules.h"
14 
15 // Entry point for LibFuzzer.
LLVMFuzzerTestOneInput(const uint8_t * data,size_t size)16 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
17   // Don't waste time parsing if the input is too large
18   // (https://crbug.com/813619). According to
19   // //testing/libfuzzer/efficient_fuzzer.md setting max_len in the build
20   // target is insufficient since AFL doesn't respect it.
21   if (size > 512)
22     return 0;
23 
24   net::ProxyBypassRules rules;
25   std::string input(data, data + size);
26   rules.ParseFromString(input);
27 
28   return 0;
29 }
30