summaryrefslogtreecommitdiff
path: root/chromium/third_party/ffmpeg/libavformat/lvfdec.c
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/ffmpeg/libavformat/lvfdec.c')
-rw-r--r--chromium/third_party/ffmpeg/libavformat/lvfdec.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/chromium/third_party/ffmpeg/libavformat/lvfdec.c b/chromium/third_party/ffmpeg/libavformat/lvfdec.c
index 8b8d6f01b92..4c87728deff 100644
--- a/chromium/third_party/ffmpeg/libavformat/lvfdec.c
+++ b/chromium/third_party/ffmpeg/libavformat/lvfdec.c
@@ -106,6 +106,7 @@ static int lvf_read_packet(AVFormatContext *s, AVPacket *pkt)
unsigned size, flags, timestamp, id;
int64_t pos;
int ret, is_video = 0;
+ int stream_index;
pos = avio_tell(s->pb);
while (!avio_feof(s->pb)) {
@@ -121,12 +122,15 @@ static int lvf_read_packet(AVFormatContext *s, AVPacket *pkt)
case MKTAG('0', '1', 'w', 'b'):
if (size < 8)
return AVERROR_INVALIDDATA;
+ stream_index = is_video ? 0 : 1;
+ if (stream_index >= s->nb_streams)
+ return AVERROR_INVALIDDATA;
timestamp = avio_rl32(s->pb);
flags = avio_rl32(s->pb);
ret = av_get_packet(s->pb, pkt, size - 8);
if (flags & (1 << 12))
pkt->flags |= AV_PKT_FLAG_KEY;
- pkt->stream_index = is_video ? 0 : 1;
+ pkt->stream_index = stream_index;
pkt->pts = timestamp;
pkt->pos = pos;
return ret;