parse_proxy_bypass_rules_fuzzer.cc 750 B

123456789101112131415161718192021222324
  1. // Copyright 2016 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 "net/proxy_resolution/proxy_bypass_rules.h"
  7. // Entry point for LibFuzzer.
  8. extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
  9. // Don't waste time parsing if the input is too large
  10. // (https://crbug.com/813619). According to
  11. // //testing/libfuzzer/efficient_fuzzer.md setting max_len in the build
  12. // target is insufficient since AFL doesn't respect it.
  13. if (size > 512)
  14. return 0;
  15. net::ProxyBypassRules rules;
  16. std::string input(data, data + size);
  17. rules.ParseFromString(input);
  18. return 0;
  19. }