Commit 39195896 authored by Andreas Rheinhardt's avatar Andreas Rheinhardt

avformat/mux: Check pkt->stream_index before using it

This commit stops using pkt->stream_index as index in an AVFormatContext's
streams array before actually comparing the value with the count of
streams in said array. 96e5e6ab used
pkt->stream_index in prepare_input_packet() before checking and
64063512 did likewise in
write_packets_common().
Signed-off-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
parent e0604d50
......@@ -761,12 +761,13 @@ static int check_packet(AVFormatContext *s, AVPacket *pkt)
static int prepare_input_packet(AVFormatContext *s, AVPacket *pkt)
{
AVStream *st;
int ret;
AVStream *st = s->streams[pkt->stream_index];
ret = check_packet(s, pkt);
if (ret < 0)
return ret;
st = s->streams[pkt->stream_index];
#if !FF_API_COMPUTE_PKT_FIELDS2 || !FF_API_LAVF_AVCTX
/* sanitize the timestamps */
......@@ -1176,10 +1177,11 @@ static int write_packets_from_bsfs(AVFormatContext *s, AVStream *st, AVPacket *p
static int write_packets_common(AVFormatContext *s, AVPacket *pkt, int interleaved)
{
AVStream *st = s->streams[pkt->stream_index];
AVStream *st;
int ret = prepare_input_packet(s, pkt);
if (ret < 0)
return ret;
st = s->streams[pkt->stream_index];
ret = check_bitstream(s, st, pkt);
if (ret < 0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment