Allen Webb | 74e49de | 2019-10-15 12:41:29 -0700 | [diff] [blame] | 1 | // Copyright 2019 The Chromium OS 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 <cstddef> |
| 6 | #include <cstdint> |
| 7 | |
| 8 | #include "u2fd/u2f_adpu.h" |
| 9 | |
| 10 | extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { |
| 11 | const char* begin = reinterpret_cast<const char*>(data); |
| 12 | uint16_t status; |
| 13 | const auto result = u2f::U2fCommandAdpu::ParseFromString( |
| 14 | std::string(begin, begin + size), &status); |
| 15 | |
| 16 | // Get some extra coverage if parsing succeeded. |
| 17 | if (result.has_value()) { |
| 18 | result.value().ToString(); |
| 19 | } |
| 20 | return 0; |
| 21 | } |