summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorcevans@chromium.org <cevans@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-08 04:26:09 +0000
committercevans@chromium.org <cevans@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-08 04:26:09 +0000
commit4df400db387b816286d2a6b1519b9d4720e83393 (patch)
tree4442a6b8c2d7b41dd79e40a7ec9a37a172160351 /media
parentfdea82655ab6e677fa5d216f7dc7b079da9012a4 (diff)
downloadchromium_src-4df400db387b816286d2a6b1519b9d4720e83393.zip
chromium_src-4df400db387b816286d2a6b1519b9d4720e83393.tar.gz
chromium_src-4df400db387b816286d2a6b1519b9d4720e83393.tar.bz2
Make sure that ffmpeg returning us an invalid stream cannot damage us too
badly. BUG=62127 TEST=Added by Andrew Review URL: http://codereview.chromium.org/4619001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@65346 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r--media/filters/ffmpeg_demuxer.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/media/filters/ffmpeg_demuxer.cc b/media/filters/ffmpeg_demuxer.cc
index e966c7b..a70a0d5 100644
--- a/media/filters/ffmpeg_demuxer.cc
+++ b/media/filters/ffmpeg_demuxer.cc
@@ -529,7 +529,12 @@ void FFmpegDemuxer::DemuxTask() {
// thread.
DCHECK_GE(packet->stream_index, 0);
DCHECK_LT(packet->stream_index, static_cast<int>(packet_streams_.size()));
- FFmpegDemuxerStream* demuxer_stream = packet_streams_[packet->stream_index];
+ FFmpegDemuxerStream* demuxer_stream = NULL;
+ size_t i = packet->stream_index;
+ // Defend against ffmpeg giving us a bad stream index.
+ if (i < packet_streams_.size()) {
+ demuxer_stream = packet_streams_[i];
+ }
if (demuxer_stream) {
// Queue the packet with the appropriate stream. The stream takes
// ownership of the AVPacket.