MidiManagerUsb should not trust indices provided by renderer.

MidiManagerUsb::DispatchSendMidiData takes |port_index| parameter. As it is
provided by a renderer possibly under the control of an attacker, we must
validate the given index before using it.

BUG=456516

Review URL: https://codereview.chromium.org/907793002

Cr-Commit-Position: refs/heads/master@{#315303}
void MidiManagerUsb::DispatchSendMidiData(MidiManagerClient* client,
                                           uint32_t port_index,
                                           const std::vector<uint8>& data,
                                           double timestamp) {
  if (port_index >= output_streams_.size()) {
    // |port_index| is provided by a renderer so we can't believe that it is
    // in the valid range.
    // TODO(toyoshim): Move this check to MidiHost and kill the renderer when
    // it fails.
    return;
  }
   output_streams_[port_index]->Send(data);
   client->AccumulateMidiBytesSent(data.size());
 }

void MidiManagerUsb::DispatchSendMidiData(MidiManagerClient* client,
                                           uint32_t port_index,
                                           const std::vector<uint8>& data,
                                           double timestamp) {
  DCHECK_LT(port_index, output_streams_.size());
   output_streams_[port_index]->Send(data);
   client->AccumulateMidiBytesSent(data.size());
 }
