1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21

media / midi / usb_midi_descriptor_parser_fuzzer.cc [blame]

// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include <stddef.h>
#include <stdint.h>

#include "media/midi/usb_midi_descriptor_parser.h"

extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
  midi::UsbMidiDescriptorParser parser;
  std::vector<midi::UsbMidiJack> jacks;
  parser.Parse(nullptr, data, size, &jacks);

  midi::UsbMidiDescriptorParser::DeviceInfo device_info;
  parser.ParseDeviceInfo(data, size, &device_info);

  std::string version =
      device_info.BcdVersionToString(device_info.bcd_device_version);
  return 0;
}