avformat/sierravmd: Don't return packets for non-existing stream

It leads to an assert in ff_read_packet().

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
(cherry picked from commit ea8f8d28d0)
This commit is contained in:
Andreas Rheinhardt 2020-08-06 01:21:38 +02:00
parent f66647daa6
commit ea42edb933

View File

@ -174,6 +174,8 @@ static int vmd_read_header(AVFormatContext *s)
avpriv_set_pts_info(vst, 33, num, den); avpriv_set_pts_info(vst, 33, num, den);
avpriv_set_pts_info(st, 33, num, den); avpriv_set_pts_info(st, 33, num, den);
} }
if (!s->nb_streams)
return AVERROR_INVALIDDATA;
toc_offset = AV_RL32(&vmd->vmd_header[812]); toc_offset = AV_RL32(&vmd->vmd_header[812]);
vmd->frame_count = AV_RL16(&vmd->vmd_header[6]); vmd->frame_count = AV_RL16(&vmd->vmd_header[6]);
@ -241,6 +243,8 @@ static int vmd_read_header(AVFormatContext *s)
current_audio_pts++; current_audio_pts++;
break; break;
case 2: /* Video Chunk */ case 2: /* Video Chunk */
if (!vst)
break;
vmd->frame_table[total_frames].frame_offset = current_offset; vmd->frame_table[total_frames].frame_offset = current_offset;
vmd->frame_table[total_frames].stream_index = vmd->video_stream_index; vmd->frame_table[total_frames].stream_index = vmd->video_stream_index;
vmd->frame_table[total_frames].frame_size = size; vmd->frame_table[total_frames].frame_size = size;