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 <fuzzer/FuzzedDataProvider.h>
9 
10 #include "components/update_client/protocol_handler.h"
11 #include "components/update_client/protocol_parser.h"
12 
13 namespace update_client {
LLVMFuzzerTestOneInput(const uint8_t * data,size_t size)14 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
15   update_client::ProtocolHandlerFactoryJSON factory;
16   std::unique_ptr<ProtocolParser> parser = factory.CreateParser();
17 
18   // Try parsing as a Response.
19   const std::string response(reinterpret_cast<const char*>(data), size);
20   parser->Parse(response);
21 
22   return 0;
23 }
24 }  // namespace update_client
25