Make sure we do not access demuxer->s_streams out of bounds

when invalid -sid is given


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@23568 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
reimar 2007-06-17 08:26:07 +00:00
parent 90f1c3cc92
commit b6e735fde1
1 changed files with 4 additions and 2 deletions

View File

@ -1257,14 +1257,16 @@ static int mp_property_sub(m_option_t * prop, int action, void *arg,
if (mpctx->stream->type != STREAMTYPE_DVD
&& mpctx->stream->type != STREAMTYPE_DVDNAV) {
int i = 0;
d_sub->sh = NULL;
for (d_sub->id = 0; d_sub->id < MAX_S_STREAMS; d_sub->id++) {
if (mpctx->demuxer->s_streams[d_sub->id]) {
if (i == dvdsub_id)
if (i == dvdsub_id) {
d_sub->sh = mpctx->demuxer->s_streams[d_sub->id];
break;
}
i++;
}
}
d_sub->sh = mpctx->demuxer->s_streams[d_sub->id];
}
if (mpctx->demuxer->type == DEMUXER_TYPE_MATROSKA)
d_sub->id = demux_mkv_change_subs(mpctx->demuxer, dvdsub_id);