blob: fdb6ca34dedb76178c8a8aba4d8471e7f24fc5af [file] [log] [blame]
// Copyright 2018 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <stddef.h>
#include <fbl/auto_call.h>
#include <hid-parser/parser.h>
// fuzz_target.cc
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
hid::DeviceDescriptor* dd = nullptr;
auto result = hid::ParseReportDescriptor(data, size, &dd);
if (result != hid::ParseResult::kParseOk) {
return 0;
}
auto cleanup = fbl::MakeAutoCall([dd]() { hid::FreeDeviceDescriptor(dd); });
size_t ff_count = 0u;
auto collection __attribute__((unused)) =
hid::GetAppCollection(hid::GetFirstInputField(dd, &ff_count));
return 0;
}