Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(848)

Unified Diff: media/midi/midi_manager_usb.cc

Issue 907793002: MidiManagerUsb should not trust indices provided by renderer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | media/midi/midi_manager_usb_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/midi/midi_manager_usb.cc
diff --git a/media/midi/midi_manager_usb.cc b/media/midi/midi_manager_usb.cc
index fcefdf5a5222891d7bfd1e62a460df67afcdb011..42c1fe84d6b5544f1a202a0fcc3cb8963d836892 100644
--- a/media/midi/midi_manager_usb.cc
+++ b/media/midi/midi_manager_usb.cc
@@ -43,7 +43,11 @@ void MidiManagerUsb::DispatchSendMidiData(MidiManagerClient* client,
uint32_t port_index,
const std::vector<uint8>& data,
double timestamp) {
- DCHECK_LT(port_index, output_streams_.size());
+ if (port_index >= output_streams_.size()) {
Takashi Toyoshima 2015/02/09 06:34:41 Can you add TODO(toyoshim) here? I think we should
yhirano 2015/02/09 08:41:12 Done.
+ // |port_index| is provided by a renderer so we can't believe that it is
+ // in the valid range.
+ return;
+ }
output_streams_[port_index]->Send(data);
client->AccumulateMidiBytesSent(data.size());
}
« no previous file with comments | « no previous file | media/midi/midi_manager_usb_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698